question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scheduling notifications with repeat is triggered at wrong date

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
eiriko2303commented, Jan 10, 2018

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

1reaction
katzercommented, Jan 10, 2018

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Schedule start of notification req… | Apple Developer Forums
If the repeat pattern is daily, the user receives notifications each day at the specified time. This works perfectly.
Read more >
Local notifications repeat interval using calendar triggers
I'm setting up some local notifications as reminders. So far I've been able to set a non repeating notification which triggers from a...
Read more >
Quick guide on local notifications for iOS - tanaschita.com
Schedule a local notification ; UNCalendarNotificationTrigger - triggers the notification at a certain date or or time.
Read more >
Scheduling daily notifications on iOS using Calendar and ...
In today's post, I'm going to focus on scheduling notifications that are essentially repeating reminders. They are notifications that are ...
Read more >
Scheduling notifications: UNUserNotificationCenter and ...
For example, the trigger – when to show the notification – can be a calendar trigger that shows the notification at an exact...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found