mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +00:00
common: fix duration comparison in PrettyAge (#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.
This commit is contained in:
parent
e6d34c1fee
commit
18a902799e
1 changed files with 1 additions and 1 deletions
|
|
@ -69,7 +69,7 @@ func (t PrettyAge) String() string {
|
||||||
result, prec := "", 0
|
result, prec := "", 0
|
||||||
|
|
||||||
for _, unit := range ageUnits {
|
for _, unit := range ageUnits {
|
||||||
if diff > unit.Size {
|
if diff >= unit.Size {
|
||||||
result = fmt.Sprintf("%s%d%s", result, diff/unit.Size, unit.Symbol)
|
result = fmt.Sprintf("%s%d%s", result, diff/unit.Size, unit.Symbol)
|
||||||
diff %= unit.Size
|
diff %= unit.Size
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue