本文整理汇总了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.')
);
}
开发者ID:ilijapavlovic95,项目名称:bescout,代码行数:26,代码来源:game-reminder.ts
示例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);
}
开发者ID:ilijapavlovic95,项目名称:bescout,代码行数:8,代码来源:calendar.ts
示例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);
}
});
开发者ID:ilijapavlovic95,项目名称:bescout,代码行数:12,代码来源:calendar.ts
注:本文中的@ionic-native/calendar.Calendar类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论