Remove unused second part of the expiry counter
This commit is contained in:
@@ -123,6 +123,13 @@ func FormatDuration(d time.Duration) string {
|
||||
case d%time.Hour == 0:
|
||||
return fmt.Sprintf("%dh", d/time.Hour)
|
||||
default:
|
||||
return d.String()
|
||||
// Duration.String() spells out every unit below the largest one, so a
|
||||
// whole number of minutes arrives as "1m0s". Drop that tail, but only
|
||||
// when the seconds really are zero: "1m30s" has to keep them.
|
||||
s := d.String()
|
||||
if strings.HasSuffix(s, "m0s") {
|
||||
s = strings.TrimSuffix(s, "0s")
|
||||
}
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user