cally: Calendar representation for value in `CalendarDate` appears very wrong
On your example page (and even in my local exploration) the CalendarMonth
widget is not being correctly represented in a couple of ways:
- The highlighted day specified by the
value
property is a month behind. In you example, value is specified as “2024-01-10” (January 10th 2024), but the highlighted day is December 10th, 2023. I see the same inconsistency locally. - Perhaps worse, is that the days do not begin on the proper day for the displayed month and year. On your example page, the month of December in 2023 is starting on Sunday, when it should be Friday. I’ll note that the month of 12/24 does start on a Sunday.
About this issue
- Original URL
- State: closed
- Created 3 months ago
- Comments: 19 (11 by maintainers)
Published as
0.4.3
. Will close this now. Hoping that’s the last of the issues here 😃Released as
0.4.2
. Thanks so much for your helpYes, that should do it:
new Intl.DateTimeFormat('en-GB', {timeZone: 'UTC'}).format(date)
→ “01/01/2024”Yes, LGTM!
It was the same bug as before, just a different manifestation.
I use DateTimeFormat to get day names based on locale. But the user’s timezone could introduce drift in the output. For the same reason it output
new Date(2024, 0, 1)
as December due to timezone differences, it treated a Monday as a Sunday and so on. Now that I fix the timezone to UTC, it won’t get affected by user’s timezone.But yes, you just configure first day of week. I think you can get this info from the browser, but I don’t think the API is widely available yet.
Appears to have fixed it. Seems the requirement (as the API suggests) is that if you want the week to start on Sunday, you must set the
first-day-of-week
attribute to 0. Prior to your change it looked like it was figuring that out from the browser locale?😂 Damn it
I think I know the cause. I’ll fix tomorrow and reopen in the meanwhile
So, not to rain on the parade, but when I go to https://wicky.nillia.ms/cally/components/calendar-date/, I see:
and while it’s now correctly selecting the expected day of the displayed year, the days do not begin on the proper day of the week. January 1st 2024 is on a Monday, which I can see is how your picture you posted looks, but when your display starts the day of the week on Sunday, it looks like it gets goofed up.
fwiw, I’m seeing this issue, as well, on your demo page at https://wicky.nillia.ms/cally/guides/theming/ (using a Chromium-flavored browser on MacOS). Here is a screenshot
I’ll check with others on my team to see if they see the same issue.