remind: Don't preserve seconds if not specified
This commit is contained in:
parent
a9acbe719e
commit
62106504ee
1 changed files with 2 additions and 2 deletions
|
@ -154,7 +154,7 @@ func parseDuration(date string) (time.Time, error) {
|
||||||
switch {
|
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:%d", &day, &month, &year, &hour, &min, &sec)):
|
||||||
case isSscanfValid(fmt.Sscanf(date, "%d/%d/%d-%d:%d", &day, &month, &year, &hour, &min)):
|
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)):
|
case isSscanfValid(fmt.Sscanf(date, "%d/%d/%d", &day, &month, &year)):
|
||||||
hour = now.Hour()
|
hour = now.Hour()
|
||||||
min = now.Minute()
|
min = now.Minute()
|
||||||
|
@ -167,7 +167,7 @@ func parseDuration(date string) (time.Time, error) {
|
||||||
day = now.Day()
|
day = now.Day()
|
||||||
month = now.Month()
|
month = now.Month()
|
||||||
year = now.Year()
|
year = now.Year()
|
||||||
sec = now.Second()
|
sec = 0
|
||||||
case isSscanfValid(fmt.Sscanf(date, "%d%c", &num, &sep)):
|
case isSscanfValid(fmt.Sscanf(date, "%d%c", &num, &sep)):
|
||||||
dur := time.Duration(num)
|
dur := time.Duration(num)
|
||||||
switch unicode.ToLower(sep) {
|
switch unicode.ToLower(sep) {
|
||||||
|
|
Reference in a new issue