-
Notifications
You must be signed in to change notification settings - Fork 7
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
UTC timestamp #34
Comments
Same issue as this #36 The issue here is because no timezone is specified it's picking up the local devices timezone, and then converting that timestamp to UTC. |
As @jawnothin said, it's using local time. To prevent that, just specify a zone/offset in your timestamp (add a
|
Thanks, it works
Why does it convert to the local device timezone? Wouldn't it be better to convert it to UTC by default? |
I assume they were trying to keep some consistency with existing parsing norms. JS native |
My example timestamp:
2024-12-28 18:32:12
Code:
const utcDate = new TZDate(timestamp, "UTC");
However, it returns:
Sat Dec 28 2024 17:32:12 GMT+0000 (Coordinated Universal Time)
Why not:
Sat Dec 28 2024 18:32:12 GMT+0000 (Coordinated Universal Time)
?The text was updated successfully, but these errors were encountered: