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

Add timezone apart from Europe, addition is Asia/Kolkata #43

Closed
anogray opened this issue Feb 5, 2022 · 1 comment
Closed

Add timezone apart from Europe, addition is Asia/Kolkata #43

anogray opened this issue Feb 5, 2022 · 1 comment

Comments

@anogray
Copy link

anogray commented Feb 5, 2022

Is it already present to allow timezone parameters to pass it or only Europe is allowed?

@Hexagon
Copy link
Owner

Hexagon commented Feb 5, 2022

All timezones supported by the javascript Date object is available. By default Croner use the timezone of the current environment. If you want to schedule in a different timezone. You can pass the timezone parameter:

console.log ("Current UTC datetime:", new Date().toUTCString());
console.log("Next 5 seconds past 10:00:00 (Pattern '* * 10 * * *0') in Asia/Kolkata, seen from UTC. ");
require("croner")("* * 10 * * *", {timezone: "Asia/Kolkata"}).enumerate(5).forEach(e => console.log(e.toUTCString()));
/*
> node tstest.js
Current UTC datetime: Sat, 05 Feb 2022 19:16:22 GMT
Next 5 seconds past 10:00:00 (Pattern '* * 10 * * *0') in Asia/Kolkata, seen from UTC. 
Sun, 06 Feb 2022 04:30:00 GMT
Sun, 06 Feb 2022 04:30:01 GMT
Sun, 06 Feb 2022 04:30:02 GMT
Sun, 06 Feb 2022 04:30:03 GMT
Sun, 06 Feb 2022 04:30:04 GMT
*/

@Hexagon Hexagon closed this as completed Feb 5, 2022
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