javascript - Cordova - 原生日历集成
<p><div>
<aside class="s-notice s-notice__info post-notice js-post-notice mb16"role="status">
<div class="d-flex fd-column fw-nowrap">
<div class="d-flex fw-nowrap">
<div class="flex--item wmn0 fl1 lh-lg">
<div class="flex--item fl1 lh-lg">
<b>关闭</b>。这个问题需要更多 <a href="https://stackoverflow.com/help/closed-questions" rel="noreferrer noopener nofollow">focused</a> .它目前不接受答案。
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>试试这个希望它会帮助你。</p>
<p> <a href="https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin" rel="noreferrer noopener nofollow">Github</a> </p>
<pre><code>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(":");
var eventMins=eventscalendar.eventtime;
eventMins=eventMins.split(":");
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);
}
}
</code></pre></p>
<p style="font-size: 20px;">关于javascript - Cordova - 原生日历集成,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/34128352/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/34128352/
</a>
</p>
页:
[1]