Skip to content

Commit 18a9027

Browse files
authored
common: fix duration comparison in PrettyAge (ethereum#33064)
This pull request updates `PrettyAge.String` so that the age formatter now treats exact unit boundaries (like a full day or week) as that unit instead of spilling into smaller components, keeping duration output aligned with human expectations.
1 parent e6d34c1 commit 18a9027

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/format.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (t PrettyAge) String() string {
6969
result, prec := "", 0
7070

7171
for _, unit := range ageUnits {
72-
if diff > unit.Size {
72+
if diff >= unit.Size {
7373
result = fmt.Sprintf("%s%d%s", result, diff/unit.Size, unit.Symbol)
7474
diff %= unit.Size
7575

0 commit comments

Comments
 (0)