Skip to content

Commit

Permalink
Merge pull request #9 from drgrib/restore-time-parse
Browse files Browse the repository at this point in the history
Restore time parsing
  • Loading branch information
drgrib authored Mar 21, 2022
2 parents 0146d0b + a3a1b3a commit 1d113d7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions parse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ func Args(t string) (time.Duration, string, error) {
seconds := int64(math.Floor((f - floatMinutes) * 60))
minutes := int64(floatMinutes)

if seconds == 0 && len(t) > 1 {
// parse as time
d, title, err := parseTime(t)
if err == nil {
return d, title, nil
}
}

d := time.Duration(minutes)*time.Minute + time.Duration(seconds)*time.Second
title := Sprintf("%vm Timer", f)
return d, title, nil
Expand Down

0 comments on commit 1d113d7

Please sign in to comment.