Use locale order when listing weekdays#54
Open
awesomund wants to merge 1 commit intobeyonk:masterfrom
Open
Conversation
Member
|
Hey - thanks for this! I've not really played with locales much at the moment, though it's on my radar. I'll have a look at this and see if it is the right solution. I might also be getting rid of dayjs because I think it's the wrong solution for a third party library. |
Member
|
@beyonk-group/engineering this is probably a blocker to i18n. We probably need to start planning. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, thanks for a great library!
As I was trying it out, i noticed what I think is a bug when changing the locale for dayjs before rendering the
Datepickercomponent: if the week starts on a different day for the given locale (e.g. monday), the weekdays and dates will not match.In my example, I was setting dayjs's locale to 'nb' (norwegian bokmål) before rendering the datepicker. Names of months and weekdays are correctly set according to the given locale, but the weekdays and dates do not match since
dayjs.weekdaysShort()is not called with thelocaleOrder-flag set totrue.dayjs.weekdaysShort(true)will return a list of weekdays where the order matches the locale used (e.g. monday first).I couldn't find any way to enforce
localOrderin my own dayjs config at first glance, so this seemed like the only solution that would work for me. Sorry if I'm missing something obvious!The
localeOrderfeature in dayjs: iamkun/dayjs#936