React-native-push-notification: localNotificationSchedule is firing inmidiatly

Created on 7 Jul 2017  路  8Comments  路  Source: zo0r/react-native-push-notification

If I use the code like in the example
date: new Date(Date.now() + (60 * 1000))
It works perfectly but if I try to create a date with some parameters it fires the notification inmidiatly, the date is well formed.
Here is a screenshot of my code

image

Stale

Most helpful comment

Hi @marcelodesouza in localNotificationSchedule method , date can not be past day date otherwise it will fire immediately , so you have to put a logic if date is past day then just add 7 day with same time(hour,minute...) . It will work, as it worked for me.

All 8 comments

Maybe the device where you're testing could has a different hour than your local system. Take into account that Date.now() gets the system hour, not the device's hour (At least if you're using a virtual device) and notification is fired according system hour, not device' hour. When you set a schedule notification in the past the notification appears inmediatly

Same issue here. I have a lot of future dateTime to schedule.. and all are firing immediately. On param date i'm using a UTC Datetime...

Hi @joaom182
Did you find the solution?

I am facing the same problem,did anyone got the solution?

the problem is we are setting notification time in past, so it fires immediately in android but iOS ignore
all the notifications which is set with past time.

Hi @marcelodesouza in localNotificationSchedule method , date can not be past day date otherwise it will fire immediately , so you have to put a logic if date is past day then just add 7 day with same time(hour,minute...) . It will work, as it worked for me.

you can use format: new Date("July 31, 2019 16:00:00")

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sungjinoh picture sungjinoh  路  3Comments

DaniShalash picture DaniShalash  路  3Comments

ssolida picture ssolida  路  3Comments

GastonEDiaz picture GastonEDiaz  路  3Comments

selimonline picture selimonline  路  3Comments