Skip to content

Commit 3f93379

Browse files
committed
fix duration
1 parent e914da2 commit 3f93379

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/duration.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ export function roundToSingleUnit(duration: Duration, {relativeTo = Date.now()}:
182182
} else if (monthsDiff < 11) {
183183
months = monthsDiff
184184
years = 0
185+
} else if (monthsDiff === 11 && years === 0) {
186+
months = 0
187+
years = 1 // the old behavior: "11 months" is rounded to "1 year"
185188
} else {
186189
months = 0
187190
years = yearDiff * sign

0 commit comments

Comments
 (0)