katzer / cordova-plugin-local-notifications

Cordova Local-Notification Plugin
Apache License 2.0
2.57k stars 1.76k forks source link

Ionic Local Notification Sunday #1735

Closed evripidesk closed 1 month ago

evripidesk commented 5 years ago

WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!

Provide a general summary of the issue.

Your Environment

Expected Behavior

I am trying to schedule weekly notification from datepicker, everything work fine except if user choose Sunday as the day to schedule notification, the Sunday is the 0 day and I get that schedule at null

Actual Behavior

when the weekday is 0, just I get trigger at null

    `let today = new Date(this.data.date);
      let hour = today.getUTCHours();
      let minutes = today.getMinutes();
      this.weekly = today.getDay();

      this.id = res.insertId;
      db.executeSql("UPDATE payments SET reminder = ? WHERE rowid = ?",[this.id,this.rowid])

      this.localNotifications.schedule({
        id: this.id,
        text: 'Weekly Reminder for '+ this.data.description+ ' '+ 'Amount: €' + this.data.amount,
        every: {  count: 1,  weekday: this.weekly, hour: hour, minute: minutes, second: 1  },
        data: {"id":  this.id, "name": "Mr.A"},
        foreground: true,  

     });`
evripidesk commented 5 years ago

also how can I schedule a notification for daily base and start from a specific date>? Itry the firstAt but now working

tigran88 commented 5 years ago

the same issue for me, all days working fine except Sunday

evripidesk commented 5 years ago

I found a workaround you can set your variable at 7th day in plugin and is working

tigran88 commented 5 years ago

Sorry, I don't understand can you explain more or show code sample how you did it

evripidesk commented 5 years ago

if the today.getDay(); is Sunday then I get for Sunday 0, so 0 Sunday, 1 Monday.....6 Saturday, the plugin doesnt understand the 0 so I have to convert the 0 to 7

tigran88 commented 5 years ago

thank you, but for me 7 is not working too

tigran88 commented 5 years ago

I understood why 7 didn't work for me, I tested it on android 5 and 6, after more testing with above versions I found it looks like it works only for android 7 and above versions