本文整理汇总了TypeScript中@ionic-native/calendar.Calendar类的典型用法代码示例。如果您正苦于以下问题:TypeScript Calendar类的具体用法?TypeScript Calendar怎么用?TypeScript Calendar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Calendar类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例3:
this.calendar.hasReadWritePermission().then((result) => {
if (result === false) {
this.calendar.requestReadWritePermission().then((v) => {
this.addEvent(gameInfo);
}, (r) => {
console.log("Rejected");
})
}
else {
this.addEvent(gameInfo);
}
});