-
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
How do I create a date in a specific timezone? #36
Comments
I came here to get the answer to that specific question... because right now it just assumes the timezone on the local device, which may or may not be correct. |
Seems like console.log(new TZDate(2025, 0, 8, 18, 'America/Chicago').toString());
// Wed Jan 08 2025 18:00:00 GMT-0600 (Central Standard Time) |
I've been looking into the same issue, which is somewhat unexpected because it suggests that the In the string case, it is "assumed" to be in a certain timezone, then convered into the desired timezone. Is there any way to achieve the second behavior using the string format as an input? |
Not sure why there is a different behavior between string and numerical values. I expect that TZDate will create a Date in the passed timezone from string that does not contain zone (and not append system timezone and convert it). date-fns-tz does this as expected. e.g.
|
I have a date like:
2025-01-08T18:00
How do I tell date-fns that this is in
America/Chicago
timezone?The text was updated successfully, but these errors were encountered: