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

Override the default timezone #64

Open
joelstein opened this issue Jul 3, 2024 · 2 comments
Open

Override the default timezone #64

joelstein opened this issue Jul 3, 2024 · 2 comments

Comments

@joelstein
Copy link

Would you consider adding a feature to set the default timezone that Tempo would use to format dates?

Perhaps deviceTZ() could be enhanced to consult a default timezone override, falling back to the device timezone if unset?

@ghiscoding
Copy link
Contributor

ghiscoding commented Jul 29, 2024

isn't tzDate() enough though? I asked similar question for UTC in an issue that I closed not long after getting more info from the author in this comment

So yes, if you want to create the utc time, in utc you can do tzDate('2020-02-04', 'utc'), but you can also do tzDate('2020-02-04T09:30', 'America/New_York') which would return a Date object (utc timestamp) for 9:30am on Feb 4th, 2020 in new york.

see tzDate docs

@joelstein
Copy link
Author

Thank you. I'm primarily concerned with formatting the dates. All of my dates come from the server in UTC, but I always want them displayed in the website's local timezone (which may be different than the user's timezone).

That's why I think being able to set a default format (or display) timezone would be useful.

As it is now, I have to remember to set the timezone in every call to format() (and there are many in this application we're building).

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