本文整理汇总了TypeScript中@ionic-native/calendar.Calendar.createEvent方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Calendar.createEvent方法的具体用法?TypeScript Calendar.createEvent怎么用?TypeScript Calendar.createEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ionic-native/calendar.Calendar
的用法示例。
在下文中一共展示了Calendar.createEvent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addEvent
addEvent(gameInfo: any) {
console.log(gameInfo);
debugger;
const title = 'Game reminder: ' + gameInfo.player;
const notes = 'vs ' + gameInfo.opponent + ', ' + gameInfo.competition;
const startDate: Date = gameInfo.date.toDate();
const endDate = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate(),
startDate.getHours() + 2, startDate.getMinutes(), startDate.getSeconds());
console.log('startDate', startDate);
console.log('endDate', endDate);
// this.calendar.createEvent('Moj Komšija događaj', this.event.locationName, '', new Date(this.event.dateFrom), new Date(this.event.dateTo)).then(
// () => {
// this.toast.presentToast('Događaj je uspešno sačuvan u kalendaru telefona.')
// }, () => {
// this.createCalendarAlert('Greška', 'Došlo je do greške prilikom čuvanja događaja. Proverite da li aplikacija ima dozvoljen pristup kalendaru i pokušajte ponovo.');
// });
this.calendar.createEvent(title, '', notes, startDate, endDate)
.then(
() => {
console.log('event created');
this.showToast();
},
() => console.log('Error occured on creating event.')
);
}
示例2: addEvent
addEvent(gameInfo: any) {
const title = 'Report reminder: ' + gameInfo.player;
const notes = 'vs' + gameInfo.opponent + ', ' + gameInfo.competition;
const startDate: Date = gameInfo.date;
const endDate = new Date(startDate.getFullYear(), startDate.getMonth() + 1, startDate.getDate(),
startDate.getHours() + 2, startDate.getMinutes(), startDate.getSeconds());
return this.calendar.createEvent(title, null, notes, startDate, endDate);
}