Skip to content

Commit

Permalink
fix duration
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Dec 4, 2024
1 parent e914da2 commit 5721bcc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/duration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ export function roundToSingleUnit(duration: Duration, {relativeTo = Date.now()}:
} else if (monthsDiff < 11) {
months = monthsDiff
years = 0
} else if (monthsDiff === 11) {
months = 0
years += 1 // the old behavior: "11 months" is rounded to "1 year"
} else {
months = 0
years = yearDiff * sign
Expand Down

0 comments on commit 5721bcc

Please sign in to comment.