-
Notifications
You must be signed in to change notification settings - Fork 157
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
Calendar.fields method #1014
Calendar.fields method #1014
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1014 +/- ##
==========================================
- Coverage 94.38% 94.30% -0.09%
==========================================
Files 18 18
Lines 6556 6657 +101
Branches 983 998 +15
==========================================
+ Hits 6188 6278 +90
- Misses 361 372 +11
Partials 7 7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
acb96bf
to
744711a
Compare
Sorry for the noise. This seems to mysteriously fail the test suite with no message (even though all the tests pass). I will investigate this before re-requesting review. |
744711a
to
113fa29
Compare
demitasse seems to swallow exceptions in @pipobscure I don't have time right now to investigate whether this still happens in demitasse 2.x, so I'm inclined to leave it, but if you prefer I can open an issue in demitasse so it doesn't get lost. |
Please do. I have to go over that in a few weeks; so I’ll certainly have forgotten this by then. |
polyfill/lib/date.mjs
Outdated
const fields = ES.ToTemporalDateFields(this, calendar); | ||
fields.calendar = calendar; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if fields() returns "calendar" as one of the fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what should be done in that case; I guess one option is to throw if calendar
is returned in the validation step I mentioned in #1014 (comment). The other option is to 🤷 and say "well, don't do that then." I'm mildly in favour of the latter since I think it's in line with what we do elsewhere for custom calendars and time zones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
→ #1047
1. If _property_ is not *"era"*, then | ||
1. Let _value_ be ? ToInteger(_value_). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes no sense to me: this would convert any custom property to an integer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is what I intended. The alternative is to treat any custom property just like era
and leave it unchanged. My reasoning was that we wouldn't want to encourage more non-numerical properties like era, but I don't have a strong opinion on which is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't assert a particular type on custom properties, except perhaps requiring that it is a primitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a clear idea of the use case of this feature, but this seems to make it impossible to use non-integer properties, rather than just discourage. I'll merge now in the interest of moving forward, but filed #1045.
These are not done yet, but in order for the spec changes for the fields() method to make sense, they at least need to be marked as such. See: #666
113fa29
to
9dcf449
Compare
The Calendar.fields method is called whenever Temporal needs to determine if a calendar object requires extra fields to uniquely identify its date. Closes: #666
9dcf449
to
292b17f
Compare
Closes: #666