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

Fix (calendar): Fixes display error due to locale first-weekday not Sunday #156 #190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

elingerojo
Copy link
Contributor

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:

  1. Accept locale region like: en-GB and de-DE. Previously only the language part was relevant, region was ignored.
  2. Compute first weekday of the week depending on region.
  3. Offset weekday names header and day number to keep phased by columns.

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.

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

Successfully merging this pull request may close these issues.

1 participant