Skip to content

Correctly round same-month day durations#361

Open
thazhemadam wants to merge 1 commit into
github:mainfrom
thazhemadam:fix-day-month-rounding
Open

Correctly round same-month day durations#361
thazhemadam wants to merge 1 commit into
github:mainfrom
thazhemadam:fix-day-month-rounding

Conversation

@thazhemadam

Copy link
Copy Markdown

Summary

Avoid rounding same-calendar-month spans like 25 or 26 days to one month via the intermediate 4-week representation.

Before this change, relative durations could move backward in precision around the month boundary:

25 days -> last month
26 days -> last month
27 days -> 27 days ago
28 days -> 28 days ago

After this change, day-only spans remain in days until they cross the calendar-month boundary.

Test plan

  • npm test

@thazhemadam thazhemadam requested a review from a team as a code owner June 29, 2026 18:14
@thazhemadam thazhemadam force-pushed the fix-day-month-rounding branch from 6478524 to 48e1b9c Compare June 29, 2026 18:16
@thazhemadam thazhemadam changed the title Fix same-month duration rounding Correctly round same-month day durations Jun 29, 2026
Relative date labels around the month boundary can currently move
backward in precision: a 25-day-old timestamp may render as "last month"
while a 27-day-old timestamp renders as "27 days ago". In sorted date
lists this makes newer items look older than later rows, even when the
underlying timestamps are ordered correctly.

Keep same-calendar-month day spans in days instead of promoting them
through the intermediate four-week representation to one month. Preserve
month rounding once the compared dates cross a calendar-month boundary.

Add regression coverage for the 25/26-day same-month cases so the labels
remain monotonic around the month boundary.
@thazhemadam thazhemadam force-pushed the fix-day-month-rounding branch from 48e1b9c to dda2ab0 Compare June 29, 2026 18:17
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.

1 participant