Skip to content
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

Merged
merged 1 commit into from
Jul 7, 2020

Conversation

justingrant
Copy link
Collaborator

- Fixes tc39#735.
- Adds tests for `Time.from` when the source is `Time` or `DateTime`.
- Also corrects an inaccurate comment.
@codecov
Copy link

codecov bot commented Jul 7, 2020

Codecov Report

Merging #736 into main will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           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           
Flag Coverage Δ
#test262 51.02% <0.00%> (-0.03%) ⬇️
#tests 87.12% <100.00%> (+<0.01%) ⬆️
Impacted Files Coverage Δ
polyfill/lib/time.mjs 96.62% <100.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 15601b1...2bc0e8a. Read the comment docs.

@justingrant justingrant mentioned this pull request Jul 7, 2020
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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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?

Copy link
Collaborator

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.

Copy link
Collaborator

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Temporal.Time.from fails when another Time object is supplied
2 participants