-
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
Problem in ISOMonthDayFromFields #1614
Comments
Yep, this is still one of the hardest parts of Temporal for me to understand, and I helped design it! :-) Below is my best understanding of these issues, but @sffc and @ptomato may know more. 1 - Good question. The docs (quoted below) and #1203 (comment) (where I believe we decided on behavior) say that if
(Note that the docs are not actually correct either, because it's also OK to provide an But the polyfill and the spec say that it should throw, even if @sffc @ptomato - Which is correct? It may be a case where the polyfill code didn't match what we'd decided in GitHub, and then the spec was authored to match the polyfill. Or did we decide later to throw in ISO too if 2 - Yes, it's intentional. See #1239. [[ReferenceISOYear]] is always normalized by Normalization is required so that comparing one PlainMonthDay instance to another (e.g. in Calendars are free to pick any algorithm they want as long as the same
Note that this algorithm isn't in the 262 spec because it only applies to non-ISO calendars. The only thing that the 262 spec needs to do is to assign 1972 for the ISO calendar. Note that this normalization behavior above applies to 3 - I don't understand this question. Could you clarify? |
I wonder why the spec is NOT
or
how come currently we use year in 12-a but not 1972 but always set 1972 in [[ReferenceISOYear]] as return? |
Notice, I am NOT talking about the algorithm in DIFFERENT calendar, I am talking about the algoirthm inside ISOMonthDayFromFields, which is NOT a calendar depend part of algorithm and is specified will NOT be changed depend on calendar. It is NOT defined in Chapter 15 again but ONLY defined Chapter 12. |
I do not understand why we need to discuss " |
... then... why in 12-a we have "Let result be ? RegulateISODate(year, month, day, overflow)." |
@justingrant Notice, the non-iso8601 calendar logic, in https://tc39.es/proposal-temporal/#sup-temporal.calendar.prototype.monthdayfromfields |
I put what I believe it should looke like in https://github.com/tc39/proposal-temporal/pull/1615/files . the purpose of that PR is to seek for understanding of what is missing from that. I understand you folks work a long time on Temporal and must have a good reason of what this part look like right now but I have hard time to understand why is it not what I specified in that PR. Just try to seek for understanding. In particular I find it very confusing about Justin's answer about 1972 and what really got used in the spec, since if year is not undefined it is used in the current spec but Justine said 1972 should always be used.... |
Whoops, I was thinking of a different part of the spec. The validation I described above is in https://tc39.es/proposal-temporal/#sec-temporal-totemporalmonthday which is earlier in the call stack than the section you're talking about. I believe that you're correct that by the time https://tc39.es/proposal-temporal/#sec-temporal-isomonthdayfromfields runs, it's OK for Therefore, I think you are correct that the spec text below (from https://tc39.es/proposal-temporal/#sec-temporal-isomonthdayfromfields) is wrong, because the validation has already happened in https://tc39.es/proposal-temporal/#sec-temporal-totemporalmonthday. (EDIT: fixed wrong spec reference right before this)
@ptomato - are Frank and I correct that the spec text above is wrong? |
Sorry for the delay in responding to this. It is a tricky part of the spec. I'm not sure if you still need an answer to the question about ToTemporalMonthDay from an earlier part of the thread, but I don't think there's anything wrong with the spec text in ToTemporalMonthDay:
I believe this correctly expresses what @justingrant wrote in prose: if the calendar is absent, then On to the question about ISOMonthDayFromFields. It's correct that as far as In my recollection, we made the decision on when to allow So, I don't agree that the spec text is wrong, I think it expresses the intention that the champions had when we made this decision. I agree this is useful to bring up in a discussion (though at this time, I personally would disagree with changing it because I don't see any new information that we didn't consider when we made the decision.) |
No, that is NOT my concern. My concern is NOT monthDayFromFields, but only ISOMonthDayFromFields. For what ever you describe above, the right way is to code that is to move the if/throw logic to both instead of INSIDE ISOMonthDayFromFields . Because if you code it inside ISOMonthDayFromFields, you cannot guarantee in OTHER calendar it will also throws. For example, if you look at |
OK, I get what your concern is now. I think this was also intentional but I'll have to look it up in the notes. Since #1623 is the same but extended to more methods, I suggest we close this one and continue the discussion there? |
I agree w/ you this issue should be discuss more generally first. But I there there are still "stange" thing in the text here (Stange in a sense that I have problem to understand, maybe just my lack of understanding and comprehansion, not necessary imply anything wrong in the spec). Let's first address the general issue in #1623 and maybe I will reopen this ticket once the more general issue got addressed if I still have problem with. (I have problem to understand what got returned in [[ReferenceISOYear]] ) |
I have hard time to understand the logic in ISOMonthDayFromFields
https://tc39.es/proposal-temporal/#sec-temporal-isomonthdayfromfields
It seems once we set referenceISOYear to 1972 in step 11, no code will ever change it, so what got set into
the [[ReferenceISOYear]] in the return of ISOMonthDayFromFields is always 1972 even if year is not undefined and used in 12-a, is that intentional?
why do we decide to use 1972 vs year in RegulateISODate or not based on the "12. If monthCode is undefined", should we depend on "if year is undefined" or not instead?
The whole logic looks very stange to me and I have hard time to undersand what it intend ot do
@justingrant @sffc @pdunkel @ptomato @ryzokuken @Ms2ger
The text was updated successfully, but these errors were encountered: