Skip to content

fix(interval): round count after flooring DST-skipped boundaries - #76

Open
draarivpatel-ui wants to merge 1 commit into
d3:mainfrom
draarivpatel-ui:fix/count-skipped-midnight
Open

draarivpatel-ui wants to merge 1 commit into
d3:mainfrom
draarivpatel-ui:fix/count-skipped-midnight

Conversation

@draarivpatel-ui

Copy link
Copy Markdown

Fixes #74.

In time zones where DST starts at midnight (e.g. America/Santiago), timeDay.floor of the transition day returns 01:00 rather than 00:00. The count function in src/interval.js used Math.floor on the computed quotient, which produced a value one too small when start is such a boundary.

Since both start and end are floored to interval boundaries before counting, the true count is always an integer. Using Math.round instead of Math.floor recovers the correct integer count even when timezone offsets introduce a fractional part.

Added regression tests covering timeDay.count and timeWeek.count for a skipped-midnight start. Full suite: 467 passed.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 23:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

timeDay.count and timeWeek.count are one too small when start is on a day whose midnight is skipped by DST

2 participants