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

Short Timezone Name in Formatter #348

Open
timsayshey opened this issue Sep 22, 2022 · 2 comments
Open

Short Timezone Name in Formatter #348

timsayshey opened this issue Sep 22, 2022 · 2 comments

Comments

@timsayshey
Copy link

The {timezone} format only returns location names like America/Chicago. Can we get a {timezone-short} that returns the timezone acronym, ie CST? Or is it already available?

@spencermountain
Copy link
Owner

hey Tim, sorry for the delay.
Yeah, this is a good idea. I've got acronym display working over here, but it would require a bit of business to do what you've described - the acronym sometims changes during dst.

These acronyms are really fraught, but also very widely used. Going from acronym->iana is a mess, but going from iana-> acronym should be possible.

yeah, i like this - i may try doing it as a plugin. if you wanted to work on it together, let me know.
cheers

@timsayshey
Copy link
Author

Hi Spencer - That's great to hear!

Here's the vanilla JS workaround that I'm using right now. Actually works really well and seems very accurate:
new Date().toLocaleTimeString('en-us',{timeZoneName:'short'}).split(' ')[2]

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

No branches or pull requests

2 participants