2014-04-18 30 views
0

当我在应用程序和手机日历中保存会议时。在我的申请中,我通常收到日期。但在日历(移动本机)我发现dateStart 10h00,dateEnd 10h00,我应该有dateStart 09h00,dateEnd 10h00。手机中的日期无法正常工作

我用这段代码在这个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); 
+0

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

试试这个更新的代码段与手机差距,这可能与区域设置有关? – Skynet

回答

0

在片段你贴我可以看你有没有options变量,你把它用在:虽然我不是精通

 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); 
+0

仍然是一样的错误:( –

相关问题