-
Notifications
You must be signed in to change notification settings - Fork 163
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
weekOfYear and yearOfWeek for Gregorian calendar needs clarifying #3096
Comments
I think that @sffc has some info on the week-numbering question. |
I think the definition of 'first week of year' is locale-dependent ( |
See tc39/proposal-intl-locale-info#86 (comment) CLDR decided to recommend consistently using ISO-8601 week numbering across all regions, primarily due to lack of evidence of user expectations contrary to that behavior. The only evidence we have of user expectations is that users who expect ISO-8601 week numbers are surprised when they switch to a different region and get different week numbers. |
Hmm, I feel like the behavior across calendars should be in scope of https://github.com/tc39/proposal-intl-era-monthcode. I fully expect that ISO and Gregorian will use the same numbering, but I can't guarantee what happens in other calendar systems. I think I recall us saying before that calendars are allowed to return undefined if week numbers are not conventionally used. I think the scope of 262 would just to be that the numbers don't change across regions within the same calendar, which is effectively what we have since these functions don't take a locale. |
Thanks @sffc. Understood that week numbers wouldn't change across regions. When you say you "fully expect that ISO and Gregorian will use the same numbering", would the spec have an opinion about that? What should Firefox do? Right now, the reference implementation does NOT produce the same values for iso8601 and gregory because: // both iso8601 and gregory expect first day-of-week to be 1 (Monday)
const fdow = id === 'iso8601' ? 1 : calendar.helper.getFirstDayOfWeek();
// iso8601 expects first week to contain 4-or-more days, whereas gregory requires only 1
const mdow = id === 'iso8601' ? 4 : calendar.helper.getMinimalDaysInFirstWeek(); |
@sffc, actually no need for a response just yet, let me dig more into the discrepancy between the reference implementation and Firefox... |
I think 262 shouldn't have an opinion but 402 could have one, in the context of https://github.com/tc39/proposal-intl-era-monthcode |
There is a lack of clarity and differences of opinion about whether the Gregorian calendar should use the ISO-8601 week numbering system.
See this Firefox bug and this bug in the Temporal polyfill repo.
The text was updated successfully, but these errors were encountered: