Conversation
It's possible for _fields_.[[Month]] to still be UNSET at the end of this operation, if the property bag contained `monthCode` and `day`. h/t fabon-f See: tc39#123
…Date Similar to the previous commit, it's possible to get here without _fields_.[[Month]] if the property bag contained `monthCode` and `day`. h/t fabon-f
Collaborator
Author
|
See discussion in #123 for description of the individual assertion failures solved by each commit. Once reviewed I'll merge this but also port it over to tc39/ecma402#1044. |
fabon-f
reviewed
Mar 4, 2026
Similar to tc39#122, the change there must also apply here. Editorial because otherwise we fail an assertion. h/t fabon-f
This needs to parallel the non-chinese/dangi case.
In this step we only need the month code, so there's no need to use the given day (which may be 30 even in a 29-day month, in which case the normal completion assertion would fail.) Make the same change in the non-chinese/dangi case even though it's not strictly necessary. h/t fabon-f
This makes the chinese/dangi and non-chinese/dangi clauses mirror each other a bit better.
Makes the behaviour of the chinese/dangi clause correspond to the non-chinese/dangi clause. This fixes an unintended regression from tc39#118. h/t fabon-f
After having fixed the assertion failures etc. in the previous commits, these two clauses look a lot more alike. It's possible to combine them, only special-casing two things for chinese/dangi: the maximum number 30 of days in month, and the extra lookup in the table to handle rare month codes. Closes: tc39#123
I find the "If X is not UNSET, Y is not UNSET" hard to reason about. We already have an if-clause that covers these two code paths, so we can move the assertions into the beginning of the if and else branches.
92aa562 to
3281a87
Compare
Collaborator
Author
|
Based on fabon-f's check in the polyfill, going to merge this and move it into tc39/ecma402#1044. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Thanks @fabon-f for pointing these out.
Fixing them made the
chinese/dangispecial cases in NonISOMonthDayToISOReferenceDate look a lot more like the non-chinese/dangicase, so it actually made sense to combine them, making the result much more readable.Closes: #123