Fix (calendar): Fixes display error due to locale first-weekday not Sunday #156 #190
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.
Issue #156
Day number and day names were out of phase when locale first-day-of-the-week was not Sunday.
The problem is that the original code assumed Sunday as the first day of the week always.
What has changed:
en-GB
andde-DE
. Previously only the language part was relevant, region was ignored.What reviewer should know:
The future and easy way to get the locale first weekday is using
Intl.locale.weekInfo.firstDay
but is not supported by all major browsers yet, to date.So that, it was obtained by a RegEx string to isolate the locale region and with a extensive region to first weekday map.
Understand that this is a hardcoded solution that will cause maintenance debt. To overcome this, both solutions were programmed but the code of the Intl.locale.weekInfo one was commented out for future use.