Correctly round same-month day durations#361
Open
thazhemadam wants to merge 1 commit into
Open
Conversation
6478524 to
48e1b9c
Compare
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.
48e1b9c to
dda2ab0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
After this change, day-only spans remain in days until they cross the calendar-month boundary.
Test plan
npm test