tzdb icon indicating copy to clipboard operation
tzdb copied to clipboard

provide locale to getTimeZones()

Open ofbeaton opened this issue 5 years ago • 5 comments

It would be nice to be able to provide the locale to getTimeZones() so that we can get the timezone strings in the language of the user. Right now it is hardcoded to English (and a specific one) which means this library cannot be used to populate tz pickers when displaying a UI in another language.

https://github.com/vvo/tzdb/blob/master/lib/getTimeZones.js

ofbeaton avatar Oct 08 '20 17:10 ofbeaton

@ofbeaton Good idea on the paper, not sure how if it would work given the current code so your best bet is to try it by forking this repository and then let me know.

I am interested in this feature yes and hope you can find a way to implement it!

Let me know :)

vvo avatar Dec 15 '20 14:12 vvo

I mean a start might be to allow the user to pass in the locale in a backwards compatible way...

export default function getTimeZones(locale = "en-US") {

But obviously more work would need to be done... Sorry if this is too obvious.

ofbeaton avatar Dec 15 '20 14:12 ofbeaton

@ofbeaton Yep that would work as a start, again I am up for the feature but I won't implement it myself as I do not need it at the moment. But you're welcome to try it and open a PR if you see it working well.

Thanks!

vvo avatar Dec 16 '20 09:12 vvo

Any luck @ofbeaton as I need the same issue right now

MohamedHegab avatar Aug 18 '21 11:08 MohamedHegab

Any update on this bug? Are we getting the improvement in any release? I need this also.

sunny7899 avatar Oct 11 '22 11:10 sunny7899