cordova-plugin-local-notifications: Scheduling notifications with repeat is triggered at wrong date

Im simply scheduling a notification. I use moment js to start the scheduling tomorrow at an hour specified by the user.

So i just simply: let date = moment(date).add(1, ‘days’).toDate() do this to get the next day. Then i just `

 //We set the new date to the next notifications
 let notification = { 
       title: "Welcome",
       text: "Lets start with your first reflection", 
       at: new Date(), 
       every: '"day"
 };
 notification.at = date;
 this.localNotifications.schedule(notification);

`

To be sure I print the notification.at, and I’ve got the tomorrow at some hour correctly. But the device don’t care about the at. It just takes the hour. Example, if I right now are the 20:00, and I scheduled something for tomorrow at 20:02, the notification is fired in two minutes.

Your Environment

  • Plugin version: 0.8.5
  • Platform: iOS
  • OS version: 11.2
  • Device manufacturer / model: iPhone 7
  • Cordova version: 7.1.0
  • Cordova platform version: 7.1.0
  • Plugin config
  • Ionic Version (if using Ionic): 3.19.0

Expected Behavior

Lets suppose it’s 22:00pm, and I schedule an hour introduced by the user (that hour will be 22:05pm) and do the next thing. let date = moment(date).add(1, ‘days’).toDate(); So the first notification must be triggered everyday starting tomorrow at 22:05.

Actual Behavior

Lets suppose it’s 22:00pm, and I schedule an hour introduced by the user (that hour will be 22:05pm) and do the next thing. let date = moment(date).add(1, ‘days’).toDate(); So the first notification must be triggered everyday starting tomorrow at 22:05, but instead, the first notification it’s triggered today at 22:05pm

Steps to Reproduce

  1. Create a date with the value of tomorrow, and with some minutes of difference with your actual hour.
  2. Schedule that date
  3. The notifications will start to be triggered today instead of tomorrow

Context

I’m trying to schedule repeating notifications everyday, starting from tomorrow.

Debug logs

Include iOS / Android logs

  • ios XCode logs
  • Android: $ adb logcat

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Ok, I am testing this on iOS in the emulator on macOS. And it still dont work. Another value like weekOfMonth work fine.

with 8.0.0 I had to remove an .xml file manually. Other then it works with both 7.1 and 8.0

Ah ok, my bad. So the plugin line in the config.xml is know looking like this: plugin name="cordova-plugin-local-notification" spec="^0.9.0-beta.1" Is that correct?

Should the cordova version be 7.1.0 or 8.0.0 ?

{ trigger: { every: { weekday: 5, hour: 16, minute: 0 } } }