Don't schedule a reminder if the reminder date is in the past
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-03-01 17:13:25 +01:00
parent 6d4ac2f2b6
commit fec60578ab
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 0 deletions

View File

@ -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
}