-
Notifications
You must be signed in to change notification settings - Fork 156
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
Editorial: Next batch of editorial issues #3053
Conversation
DifferenceISODateTime asserts that the ISO Date-Time Records passed to it are within limits. Previously there were two places where this was not guaranteed to be the case. Add checks that throw RangeError so the assertion is not hit. Closes: #3015
The default formatter would look for a property called _repr_, which does not exist, and therefore would be confusingly formatted as "undefined". Instead, delegate to the original Intl.DateTimeFormat's util.inspect output.
In a94a793 the desired behaviour when formatting Temporal objects was accidentally applied to formatting Date objects. So new Date().toLocaleDateString([], { hour: "numeric" }); would result in bestFormat being null, and according to the type assertion of the Intl.DateTimeFormat [[DateTimeFormat]] internal slot, that is not possible. Checking that _inherit_ = ~relevant~ here ensures the new behaviour is only applied to Temporal objects, and the type assertion is not hit. See: #3049
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3053 +/- ##
=======================================
Coverage 95.73% 95.73%
=======================================
Files 21 21
Lines 9705 9716 +11
Branches 1742 1742
=======================================
+ Hits 9291 9302 +11
Misses 363 363
Partials 51 51 ☔ View full report in Codecov by Sentry. |
cc @anba @trflynn89 |
Some of the DateTimeFormat internal slots may contain null instead of a DateTime Format Record, if no relevant fields were given. That needs to be reflected in the return type of this operation.
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.
Thanks!
new Date().toLocale{Date,Time,}String()
(see The chosen best format inIntl.DateTimeFormat
is potentially null #3049)