formkit / tempo

📆 Parse, format, manipulate, and internationalize dates and times in JavaScript and TypeScript.
https://tempo.formkit.com
MIT License
2.37k stars 33 forks source link

Feature request: More timezone formats #9

Closed am-maneaters closed 9 months ago

am-maneaters commented 9 months ago

Looks like the only option currently is "Z" for timezone offset (+0800).

Looking at Intl.DateTimeFormat['timezonename'] property, these could be useful:

MDN reference https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#timezonename

justin-schroeder commented 9 months ago

The reason this is not currently supported is we’d like Tempo to always be able to parse any tokens that it formats, and (as far as I know) there is no way to take a timezone like "Nordamerikanische Westküstenzeit" and turn it into the correct offset.

That said — if you know of a way to do this, lets get crackin'!

am-maneaters commented 9 months ago

Ha, very fair. Looking through some of the generated timezones and just thinking about solving this problem gives me nightmares: https://stackblitz.com/edit/vitejs-vite-ffhsi9?file=src%2FApp.tsx

Thank you!