Skip to content

Comments

Polyfill: Fix precision loss rounding large durations to days#3280

Open
jessealama wants to merge 1 commit intotc39:mainfrom
jessealama:fix-duration-day-rounding-precision
Open

Polyfill: Fix precision loss rounding large durations to days#3280
jessealama wants to merge 1 commit intotc39:mainfrom
jessealama:fix-duration-day-rounding-precision

Conversation

@jessealama
Copy link
Collaborator

Fixes #3259.

Adds defensiveness for handling non-integer numbers of days by using bigInt-backed rounding for the smallestUnit === 'day' path, matching how other time units are already handled. Other time units don't appear to be affected.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.09%. Comparing base (86a7b46) to head (eae2c0f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3280   +/-   ##
=======================================
  Coverage   98.09%   98.09%           
=======================================
  Files          22       22           
  Lines       10457    10458    +1     
  Branches     1808     1808           
=======================================
+ Hits        10258    10259    +1     
  Misses        182      182           
  Partials       17       17           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jessealama jessealama requested a review from ptomato February 19, 2026 18:23
Use bigInt-backed rounding for the smallestUnit === 'day' path,
matching how other time units are already handled.
@jessealama jessealama force-pushed the fix-duration-day-rounding-precision branch from 6cfdd51 to eae2c0f Compare February 19, 2026 18:40
@ptomato
Copy link
Collaborator

ptomato commented Feb 19, 2026

Not going to get to this today, unfortunately — I need a bit more time to understand it. I'll try to take another look tomorrow.

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.

polyfill: rounding large duration to days causes 1 day error

2 participants