日期PhoneGap的工作不正常 [英] Date in phonegap doesn't work correctly

查看:95
本文介绍了日期PhoneGap的工作不正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我保存在我的应用程序,并在移动的日历会议。在我的应用程序,我得到的日期正常。但在日历(移动母语)我发现dateStart 10h00,dateEnd 10h00,我应该有dateStart 09:00,dateEnd 10h00。

我用这个code保存从该github上<一个日历会议href=\"https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/blob/cc57eeec417f7a41d8ffcb07a0986192df4fb712/README.md\"相对=nofollow>日历插件。

  VAR的startDate =新的日期(2014,4,18,9,0,0,0,1);
//控制台的时间:星期五2014年4月18日9:00:00 GMT + 0100(BST)
      VAR结束日期=新的日期(2014,4,18,10,0,0,0,1);
      VAR标题=我很好事件
      VAR位置=家;
      VAR笔记=有关此事件的一些注意事项。
      VAR成功=功能(消息){警报(成功+ JSON.stringify(消息)); };
      VAR误差=功能(消息){警报(错误:+消息); };   变种calOptions = window.plugins.calendar.getCalendarOptions(); //取得默认值
  calOptions .firstReminderMinutes = 60; //默认值是60,传入null无提示(报警)
  window.plugins.calendar.createEventWithOptions(title,location,notes,startDate,endDate,calOptions,success,error);


解决方案

在片段你贴我可以看你有没有选项变量,你把它用在:

<$p$p><$c$c>window.plugins.calendar.createEventWithOptions(title,location,notes,startDate,endDate,options,success,error);

试试这个更新片段:

  VAR的startDate =新的日期(2014,4,18,9,0,0,0,1);
//控制台的时间:星期五2014年4月18日9时00分〇〇秒GMT + 0100(BST)
      VAR结束日期=新的日期(2014,4,18,10,0,0,0,1);
      VAR标题=我很好事件
      VAR位置=家;
      VAR笔记=有关此事件的一些注意事项。
      VAR成功=功能(消息){警报(成功+ JSON.stringify(消息)); };
      VAR误差=功能(消息){警报(错误:+消息); };    变种calOptions = window.plugins.calendar.getCalendarOptions(); //取得默认值
      calOptions.firstReminderMinutes = 120; //默认值是60,传入null无提示(报警)
      window.plugins.calendar.createEventWithOptions(title,location,notes,startDate,endDate,calOptions,success,error);

When I save a meeting in my application and in calendar of the mobile. In my application, I got the date normally. But in the calendar(mobile Native) I found dateStart 10h00, dateEnd 10h00, I should have dateStart 09h00, dateEnd 10h00 .

I used this code to save the meeting in the calendar from this github Calendar Plugin.

      var startDate = new Date(2014,4,18,9,0,0,0,1);
//The time in console : Fri Apr 18 2014 9:00:00 GMT+0100 (BST)
      var endDate = new Date(2014,4,18,10,0,0,0,1);
      var title = "My nice event";
      var location = "Home";
      var notes = "Some notes about this event.";
      var success = function(message) { alert("Success: " + JSON.stringify(message)); };
      var error = function(message) { alert("Error: " + message); };

   var calOptions = window.plugins.calendar.getCalendarOptions(); // grab the defaults
  calOptions .firstReminderMinutes = 60; // default is 60, pass in null for no reminder (alarm)
  window.plugins.calendar.createEventWithOptions(title,location,notes,startDate,endDate,calOptions,success,error);

解决方案

In the snippet you posted I can see you have no options variable and you used it in:

window.plugins.calendar.createEventWithOptions(title,location,notes,startDate,endDate,options,success,error);

Try this updated snippet:

     var startDate = new Date(2014,4,18,9,0,0,0,1);
//The time in console : Fri Apr 18 2014 9:00:00 GMT+0100 (BST)
      var endDate = new Date(2014,4,18,10,0,0,0,1);
      var title = "My nice event";
      var location = "Home";
      var notes = "Some notes about this event.";
      var success = function(message) { alert("Success: " + JSON.stringify(message)); };
      var error = function(message) { alert("Error: " + message); };

    var calOptions = window.plugins.calendar.getCalendarOptions(); // grab the defaults
      calOptions.firstReminderMinutes = 120; // default is 60, pass in null for no reminder (alarm)
      window.plugins.calendar.createEventWithOptions(title,location,notes,startDate,endDate,calOptions,success,error);

这篇关于日期PhoneGap的工作不正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆