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

localeData weekdays should take in account weekStart #821

Closed
Titoine opened this issue Mar 6, 2020 · 3 comments
Closed

localeData weekdays should take in account weekStart #821

Titoine opened this issue Mar 6, 2020 · 3 comments

Comments

@Titoine
Copy link

Titoine commented Mar 6, 2020

Hi,

Describe the bug
When using a local with a weekStart on Monday, localData weekdays return Sunday at first.

Expected behavior
localData should return weekdays with Monday first.
https://codesandbox.io/s/confident-cache-wibqg

Information

  • Day.js Version [e.g. v1.8.21]
@iamkun
Copy link
Owner

iamkun commented Mar 6, 2020

this is expected behavior. Same as moment.js

@Titoine
Copy link
Author

Titoine commented Mar 6, 2020

Ok, fine.

@Titoine Titoine closed this as completed Mar 6, 2020
@OlivierSte
Copy link

I have the same need.
Moment accepts a boolean as parameter for weekdays() to allow weekStart in locale to be taken into consideration.
Although I don't think it's implemented in dayjs as it throws an error atm when I pass true as param.

As of 2.13.0 you can pass a bool as the first parameter of the weekday functions. If true, the weekdays will be returned in locale specific order. For instance, in the Arabic locale, Saturday is the first day of the week, thus:

moment.locale('ar');
moment.weekdays(true); // lists weekdays Saturday-Friday in Arabic
moment.weekdays(true, 2); //will result in Monday in Arabic

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

3 participants