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

en-US locale is missing #1532

Open
m-zzz opened this issue Jun 16, 2021 · 6 comments
Open

en-US locale is missing #1532

m-zzz opened this issue Jun 16, 2021 · 6 comments

Comments

@m-zzz
Copy link

m-zzz commented Jun 16, 2021

Describe the bug
Is the locale "en" the same as "en-us"?
I see here https://unpkg.com/dayjs@1.10.5/locale.json just "es-us" locale for United States.

Expected behavior
Maybe it make sense to add also "en-us" locale?

Information

  • Day.js Version 1.10.5
@MirzaLeka
Copy link

MirzaLeka commented Aug 11, 2021

I believe the DayJS defaults to en-us when you don't specify any or set locale as 'en-us' without importing it.
I think en locale is the same as en-gb

But yeah it's confusing

@barrymichaeldoyle
Copy link

A bit frustrating since en-gb and en-us aren't the same... Eg. in US dates are formatted like MM/DD/YYYY, however in GB it's formatted like this: DD/MM/YYYY

@MirzaLeka
Copy link

It's simple really.
If you need to use one or the other, just call the locale method with it.

dayjs().locale('en-us').format('ll'); // Dec 21, 2021
dayjs().locale('en-gb').format('ll'); // 21 Dec 2021

Given that en-US is the default, you won't be importing it. You can learn more about Day.js locales here.

@barrymichaeldoyle
Copy link

That that's not working... When I set my locale to en-gb the date format is still MM/DD/YYYY when it should be DD/MM/YYYY

@barrymichaeldoyle
Copy link

Nevermind, I got it sorted after readying your blog post, thank you!

@hervehobbes
Copy link

When using the localeData plugin, except if you use (load) 'en-gb', you don't have the requested functions (methods), for example globalLocaleData.longDateFormat('L') or globalLocaleData.weekdaysMin() and so on.

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

4 participants