Skip to content

Increase rounding rules in roundToSingleUnit to 90% of the next largest unit#234

Merged
keithamus merged 1 commit intomainfrom
increase-roundign-rules-in-roundtosingleunit-to-90-of-the-next-largest-unit
Dec 16, 2022
Merged

Increase rounding rules in roundToSingleUnit to 90% of the next largest unit#234
keithamus merged 1 commit intomainfrom
increase-roundign-rules-in-roundtosingleunit-to-90-of-the-next-largest-unit

Conversation

@keithamus
Copy link
Copy Markdown
Contributor

#226 aimed to simplify the various relative durations we render. In doing so, we used a traditional half rounding method where if the value was over half way toward the next largest value then it'd be rounded up to the next largest value (e.g. 31 minutes became 1hr). Unfortunately this is a bit too generous for rounding dates, the loss becomes especially apparent when a date from 6 months ago says "last year".

This PR rectifies #226 by instead rounding at 90% (e.g. 55 minutes will be rounded to 1hr). This makes distant dates far more acceptable, for example a date 11 months ago will say "last year". This should "feel" more accurate when reading relative dates.

@keithamus keithamus requested a review from a team as a code owner December 16, 2022 08:52
@keithamus keithamus force-pushed the increase-roundign-rules-in-roundtosingleunit-to-90-of-the-next-largest-unit branch from b7f8e98 to fc62cde Compare December 16, 2022 08:57
@keithamus keithamus changed the title Increase roundign rules in roundToSingleUnit to 90% of the next largest unit Increase rounding rules in roundToSingleUnit to 90% of the next largest unit Dec 16, 2022
@keithamus keithamus merged commit 954dcd5 into main Dec 16, 2022
@keithamus keithamus deleted the increase-roundign-rules-in-roundtosingleunit-to-90-of-the-next-largest-unit branch April 18, 2023 13:32
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