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

Normative: Fixed DifferenceInstant #2477

Merged
merged 1 commit into from
Feb 1, 2023
Merged

Conversation

Aditi-1400
Copy link
Collaborator

Made changes to DifferenceInstant operation to prevent loss of precision.
The approach is to convert the nanoseconds into seconds, milliseconds ≤ 999, microseconds ≤ 999, and
nanoseconds ≤ 999 before passing those values to RoundDuration.

Fixes: #2419

@codecov
Copy link

codecov bot commented Jan 16, 2023

Codecov Report

Merging #2477 (1032534) into main (62524fc) will increase coverage by 0.12%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2477      +/-   ##
==========================================
+ Coverage   94.81%   94.94%   +0.12%     
==========================================
  Files          20       20              
  Lines       10842    10821      -21     
  Branches     1972     1957      -15     
==========================================
- Hits        10280    10274       -6     
+ Misses        502      487      -15     
  Partials       60       60              
Impacted Files Coverage Δ
polyfill/lib/ecmascript.mjs 98.29% <0.00%> (-0.01%) ⬇️
polyfill/lib/duration.mjs 96.03% <0.00%> (+0.59%) ⬆️
polyfill/lib/plaindatetime.mjs 97.23% <0.00%> (+0.61%) ⬆️
polyfill/lib/plaindate.mjs 99.66% <0.00%> (+0.98%) ⬆️
polyfill/lib/plainyearmonth.mjs 98.36% <0.00%> (+1.57%) ⬆️
polyfill/lib/plainmonthday.mjs 97.67% <0.00%> (+2.21%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Aditi-1400 Aditi-1400 changed the title Fixed DifferenceInstant Normative: Fixed DifferenceInstant Jan 16, 2023
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.

Great! I believe this will solve the problem, and that it's already covered by test262 tests.

cc @anba

spec/instant.html Outdated Show resolved Hide resolved
@ptomato
Copy link
Collaborator

ptomato commented Jan 16, 2023

I'll mark this as draft until it's presented in the TC39 plenary.

spec/instant.html Outdated Show resolved Hide resolved
@ptomato ptomato marked this pull request as ready for review February 1, 2023 01:05
@ptomato
Copy link
Collaborator

ptomato commented Feb 1, 2023

This change achieved consensus at the TC39 plenary of 2023-01-31. It is already covered by test262 tests.

@ptomato ptomato merged commit 5a07094 into tc39:main Feb 1, 2023
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.

RoundDuration/CreateDurationRecord in DifferenceInstant can lead to imprecise results
2 participants