关闭。这个问题需要更多
focused .它目前不接受答案。
Best Answer-推荐答案 strong>
试试这个希望它会帮助你。
Github
var strCalender = { "summary": strEventName,"eventDesc": strCategoryName,"begin": new Date(y, m, d),"beginYear": y,"beginMonth": m,"beginDate": d,"endYear": y,"endMonth": m,"endDate": d,"end": new Date(y, m, d), "eventtype": "1", "categoury": strCategoryName, "venue": strVenue, "color": "blue", "eventtime": strTime, "eventDate": strDate, "eventdetails": strClickStrings }
calendarInNativeApp(strCalender);
function calendarInNativeApp(eventscalendar){
var eventHours=eventscalendar.eventtime;
eventHours=eventHours.split(":")[0];
var eventMins=eventscalendar.eventtime;
eventMins=eventMins.split(":")[1];
var eventsInfo = eventscalendar;
var startDate = new Date(eventsInfo.beginYear,eventsInfo.beginMonth,eventsInfo.beginDate,eventHours,eventMins,0,0,0); // beware: month 0 = january, 11 = december
var endDate = new Date(eventsInfo.endYear,eventsInfo.endMonth,eventsInfo.endDate,23,59,0,0,0);
var deleteStartDate = new Date(2015,5,10,18,30,0,0,0); // beware: month 0 = january, 11 = december
var deleteEndDate = new Date(2015,5,10,19,30,0,0,0);
var deleteTitle="Event4";
var title = eventsInfo.summary;
var eventLocation = eventsInfo.venue;
var notes = eventsInfo.eventDesc;
var success = function(message) {JSON.stringify(message); };
var error = function(message) { message; };
if(device.platform == "iOS"){
var createCalOptions = window.plugins.calendar.getCreateCalendarOptions();
createCalOptions.calendarName = "Calendar";
createCalOptions.calendarColor = "#FF0000"; // an optional hex color (with the # char), default is null, so the OS picks a color
createCalOptions.firstReminderMinutes = 120; // default is 60, pass in null for no reminder (alarm)
createCalOptions.secondReminderMinutes = 5;
window.plugins.calendar.createCalendar(createCalOptions,success,error);
window.plugins.calendar.createEventInNamedCalendar(title,eventLocation,notes,startDate,endDate,"Calendar",success,error);
}
else if(device.platform == "Android"){
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,eventLocation,notes,startDate,endDate,calOptions,success,error);
}
}
关于javascript - Cordova - 原生日历集成,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/34128352/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) |
Powered by Discuz! X3.4 |