remind: Don't preserve seconds if not specified

This commit is contained in:
Hamcha 2017-05-04 17:16:23 +02:00
parent a9acbe719e
commit 62106504ee
1 changed files with 2 additions and 2 deletions

View File

@ -154,7 +154,7 @@ func parseDuration(date string) (time.Time, error) {
switch {
case isSscanfValid(fmt.Sscanf(date, "%d/%d/%d-%d:%d:%d", &day, &month, &year, &hour, &min, &sec)):
case isSscanfValid(fmt.Sscanf(date, "%d/%d/%d-%d:%d", &day, &month, &year, &hour, &min)):
sec = now.Second()
sec = 0
case isSscanfValid(fmt.Sscanf(date, "%d/%d/%d", &day, &month, &year)):
hour = now.Hour()
min = now.Minute()
@ -167,7 +167,7 @@ func parseDuration(date string) (time.Time, error) {
day = now.Day()
month = now.Month()
year = now.Year()
sec = now.Second()
sec = 0
case isSscanfValid(fmt.Sscanf(date, "%d%c", &num, &sep)):
dur := time.Duration(num)
switch unicode.ToLower(sep) {