Skip to content

Commit e999700

Browse files
committed
Formatting
1 parent ad5b7fd commit e999700

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

frontend/cli/cmd/duration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func ParseDuration(s string) (time.Duration, error) {
1111
s = strings.TrimSpace(s)
12-
12+
1313
if strings.HasSuffix(s, "d") {
1414
daysStr := strings.TrimSuffix(s, "d")
1515
days, err := strconv.ParseFloat(daysStr, 64)
@@ -18,7 +18,7 @@ func ParseDuration(s string) (time.Duration, error) {
1818
}
1919
return time.Duration(days * 24 * float64(time.Hour)), nil
2020
}
21-
21+
2222
return time.ParseDuration(s)
2323
}
2424

frontend/cli/cmd/time_format.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import (
99
func FormatRelativeTime(t time.Time) string {
1010
now := time.Now()
1111
duration := t.Sub(now)
12-
12+
1313
absDuration := duration
1414
if absDuration < 0 {
1515
absDuration = -absDuration
1616
}
17-
17+
1818
var value int
1919
var unit string
20-
20+
2121
if absDuration < time.Hour {
2222
value = int(math.Round(absDuration.Minutes()))
2323
unit = "minute"
@@ -28,14 +28,14 @@ func FormatRelativeTime(t time.Time) string {
2828
value = int(math.Round(absDuration.Hours() / 24))
2929
unit = "day"
3030
}
31-
31+
3232
if value != 1 {
3333
unit += "s"
3434
}
35-
35+
3636
if duration < 0 {
3737
return fmt.Sprintf("%d %s ago", value, unit)
3838
}
39-
39+
4040
return fmt.Sprintf("in %d %s", value, unit)
4141
}

0 commit comments

Comments
 (0)