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

[feature request] add zh as a locale in accordance with window.navigator.languages #820

Closed
ZYinMD opened this issue Mar 6, 2020 · 2 comments

Comments

@ZYinMD
Copy link
Contributor

ZYinMD commented Mar 6, 2020

In my app, I use window.navigator.languages to decide which locale to use to render relative date for my users. One thing I noticed is that zh is a valid locale in browsers, but not available in dayjs. It's an issue because I'm forced to pick a locale between zh-cn, zh-tw, and zh-hk for the user, and I don't know which to pick.

To see zh in Chrome, go to the ⋮ menu -> Settings -> Advanced (on the left sidebar) -> Languages -> Add languages -> Add Chinese. Then you'll see zh appear in your navigator.languages.

There are already other cases where a generic locale and its sub locales co-exists in dayjs, for example, es, es-us, es-do; fr, fr-ca, fr-ch, so I think adding a zh is completely reasonable.

I'd be happy to submit a PR if this can be agreed upon.

@iamkun
Copy link
Owner

iamkun commented Mar 6, 2020

@ZYinMD ZYinMD mentioned this issue Mar 7, 2020
@iamkun
Copy link
Owner

iamkun commented Mar 10, 2020

fixed

@iamkun iamkun closed this as completed Mar 10, 2020
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