Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule date not working as expected #193

Open
andresilva-cc opened this issue Jul 13, 2020 · 4 comments
Open

Schedule date not working as expected #193

andresilva-cc opened this issue Jul 13, 2020 · 4 comments

Comments

@andresilva-cc
Copy link

andresilva-cc commented Jul 13, 2020

I'm trying to use this plugin to set up daily reminders for the user. The user can choose the time of the reminder then the app schedules the notification with 'day' interval. I was trying to create the date object like this:

const date = new Date();
date.setHours(15, 0); // actually it's a variable with the value the user set

The problem is that when I console.log the date, it shows the right hour/minute but in the wrong timezone (UTC), when the device (in this case an Android Emulator) is actually running with GMT -3 timezone (America/Sao_Paulo).

In any case, I tried to set up the notification to see what happens, but the notification won't show. I tried in a lot of different ways, using Unix time, using moment, moment-timezone, but each time I tried it would not give the right result.

The question I would ask here is: how to handle timezones when scheduling the notification?

But, I tried using the demo this repository provides, where it schedules the notification to 5 seconds from now using this:

new Date(new Date().getTime() + (5 * 1000));

And guess what? It doesn't show after 5 seconds, but after like 2 minutes. I also tried using different values (like 3-5 minutes), but they also show at the wrong time. This made me think that maybe whatever causing this is also related to the timezone problem I'm having.

In any case, any help on this would be very appreciated.

PS: Tested only on Android

@andresilva-cc
Copy link
Author

Any help on this?

@Cersin
Copy link

Cersin commented Dec 16, 2020

I have the same problem, cant find a solution.

@Cersin
Copy link

Cersin commented Dec 16, 2020

Delete interval and it works...

@andresilva-cc
Copy link
Author

Delete interval and it works...

I ended up using a server-side solution, but as far as I remember I didn't set a value for interval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants