Don't schedule a reminder if the reminder date is in the past
This commit is contained in:
parent
6d4ac2f2b6
commit
fec60578ab
1 changed files with 7 additions and 0 deletions
|
@ -165,6 +165,12 @@ export default class TaskModel extends AbstractModel {
|
|||
}
|
||||
|
||||
async scheduleNotification(date) {
|
||||
|
||||
if(date < new Date()) {
|
||||
console.debug('Date is in the past, not scheduling a notification. Date is ', date)
|
||||
return
|
||||
}
|
||||
|
||||
if (!('showTrigger' in Notification.prototype)) {
|
||||
console.debug('This browser does not support triggered notifications')
|
||||
return
|
||||
|
@ -178,6 +184,7 @@ export default class TaskModel extends AbstractModel {
|
|||
|
||||
const registration = await navigator.serviceWorker.getRegistration()
|
||||
if (typeof registration === 'undefined') {
|
||||
console.error('No service worker registration available')
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue