-
Notifications
You must be signed in to change notification settings - Fork 158
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
CalendarMonthDayToISOReferenceDate: Align ISO-8601 and non-ISO calendar behaviour when "year" is present #2863
Comments
CalendarMonthDayToISOReferenceDate does require taking
That paragraph should probably be expanded to also explicitly align with RegulateISODate when overflow is "constrain" as well, which would affect both |
My understanding (@ptomato correct me if I'm wrong) is that removing custom calendars in #2854 will make this problem moot, because we can remove ISOYear (for PMD) and ISODay (for PYM) from being observable. So in that case the year or day, respectively, of the inputs should not matter. Philip is this correct? |
This about the day in a PlainMonthDay. When implementing CalendarMonthDayToISOReferenceDate in https://phabricator.services.mozilla.com/D211772, I've started with the case when js> Temporal.PlainMonthDay.from({calendar: "gregory", monthCode: "M02", day: 30}).toString()
"1972-02-29[u-ca=gregory]" The spec text doesn't mention if js> Temporal.PlainMonthDay.from({calendar: "gregory", year: 2023, monthCode: "M02", day: 30}).toString()
"1972-02-29[u-ca=gregory]" I've compared this against the spec polyfill and saw that ignoring Then I've added support for the case when js> Temporal.PlainMonthDay.from({calendar: "gregory", year: 2023, month: 2, day: 30}).toString()
"1972-02-29[u-ca=gregory]" Notice that in all cases the result is When I then compared the result for the last case against the spec polyfill, I've noticed that the spec polyfill returns So now I'm unsure which results are actually correct?
|
Relevant test262 test is https://github.com/tc39/test262/blob/42a9f69ab2c42150ff0b18c7a8c8dffb7b1015e2/test/intl402/Temporal/Calendar/prototype/monthDayFromFields/reference-year-1972.js#L13-L25, which expects the exact polyfill behaviour. |
Meeting 2024-05-30: @gibson042 will make a PR matching his comment above. |
@gibson042 Will you have time for this in the near future, or should I take it over? |
…DayToISOReferenceDate (and update the polyfill accordingly) Fixes tc39#2863
…MonthDayToISOReferenceDate. r=allstarschh See also: - tc39/proposal-temporal#2863 - tc39/proposal-temporal#2864 Differential Revision: https://phabricator.services.mozilla.com/D228027
…MonthDayToISOReferenceDate. r=allstarschh See also: - tc39/proposal-temporal#2863 - tc39/proposal-temporal#2864 Differential Revision: https://phabricator.services.mozilla.com/D228027
ISO-8601 calendar when
year
field is present:day
is constrained to 28, because the year 2023 is not a leap year.Gregorian calendar as implemented in the spec polyfill:
Notice that when
monthCode
is present,year
is ignored becauseday
isn't constrained to 28, but instead set to 29.Relevant abstract operations:
Neither CalendarResolveFields nor CalendarMonthDayToISOReferenceDate seem to require that
year
is taken into account, so these are also valid results:These results can happen when first resolving
year + month
to a month code (here: "M02") and then resolving the month code and day pair.The text was updated successfully, but these errors were encountered: