-
Notifications
You must be signed in to change notification settings - Fork 155
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
Fix Time.from
when param is another Time
#736
Conversation
- Fixes tc39#735. - Adds tests for `Time.from` when the source is `Time` or `DateTime`. - Also corrects an inaccurate comment.
Codecov Report
@@ Coverage Diff @@
## main #736 +/- ##
=======================================
Coverage 92.33% 92.33%
=======================================
Files 17 17
Lines 4734 4735 +1
Branches 744 744
=======================================
+ Hits 4371 4372 +1
Misses 360 360
Partials 3 3
Continue to review full report at Codecov.
|
minute = GetSlot(item, MINUTE); | ||
second = GetSlot(item, SECOND); | ||
millisecond = GetSlot(item, MILLISECOND); | ||
microsecond = GetSlot(item, MICROSECOND); | ||
nanosecond = GetSlot(item, NANOSECOND); | ||
} else { | ||
// Intentionally alphabetical | ||
// Intentionally largest to smallest units |
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.
For future reference, we can just delete this comment, but no need to block the PR on it. (Calling the property getters on a passed-in object in alphabetical order is mandated by the spec, which is now implemented in ES.ToTemporalTimeRecord
. Here, they can be in any old order.
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.
Calling the property getters on a passed-in object in alphabetical order is mandated by the spec
OK, got it. Out of curiosity, why is alpha order required?
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.
Alphabetical doesn't really matter, but some order is required to be specified, since the calls are observable by client code if you pass in a Proxy, for example. I'm not sure why alphabetical was chosen originally as the arbitrary order, but I'd guess it's because there's some precedent elsewhere.
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!
Temporal.Time.from
fails when anotherTime
object is supplied #735.Time.from
when the source isTime
orDateTime
.