【发布时间】:2020-09-19 22:35:27
【问题描述】:
我正在开发一个应用程序,其中包含来自数据库的值的本地通知。但是,它会无数次重复相同值的通知,直到更改为另一个。
示例:
1st - “房子 #1 的发票将过期”
2nd - “房子 #1 的发票将过期”
3rd - “2号房子的发票将过期”
知道这可能是什么以及如何解决吗?
calculateDif(idHouse, dateBill) {
let billDate= moment(dateBill);
var MyDate = new Date();
var MyDateString;
MyDateString = MyDate.getFullYear() + '-' + ('0' + (MyDate.getMonth()+1)).slice(-2)
+ '-' + ('0' + MyDate.getDate()).slice(-2);
let warningDate= billDate.diff(MyDateString, 'days');
if (warningDate <= 5) {
this.localNotifications.schedule({
id: 1,
text: 'The invoice of house ' idHouse + ' will expire',
sound: null,
data: { secret: 1 }
});
}
}
【问题讨论】:
标签: angularjs typescript cordova ionic-framework cordova-plugins