我正在尝试在特定日期和时间显示通知。我已经尝试了很多,但从未在模拟器中显示过。我找到并编辑了这段代码:
createnotification() {
let remindid = new Date().getUTCMilliseconds();
this.date = moment(“2019-01-31 12:20:00”).format(“YYYY-MM-DD HH:mm:ss”);
let notification = {
id: remindid,
title: this.title,
text: this.description,
forceShow: 'true',
coldstart: true,
foreground: false,
at: this.date
};
cordova.plugins.notification.local.schedule(notification);
let alert = this.alrtCtrl.create({
title: 'Notifications set at ' + this.date,
buttons: ['Ok']
});
alert.present();
}
我认为这与“ at”属性有关。我使用“触发”属性尝试了不同的日期变化。似乎没有任何作用。
我想念什么?
答案 0 :(得分:0)
已修复:
月份数字从零开始,所以我指的是三月。
一月= 0
2月= 1
3月= 2
等等。