mirror of https://github.com/spf13/cast.git
[bugfix] parse unix timestamp to time.Time from string
Fixing https://github.com/spf13/cast/issues/102
This commit is contained in:
parent
8d17101741
commit
e85dcc8b38
4
caste.go
4
caste.go
|
@ -1273,6 +1273,10 @@ func parseDateWith(s string, dates []string) (d time.Time, e error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if i, err := strconv.Atoi(t); err == nil {
|
||||||
|
return time.Unix(int64(i), 0), nil
|
||||||
|
}
|
||||||
|
|
||||||
return d, fmt.Errorf("unable to parse date: %s", s)
|
return d, fmt.Errorf("unable to parse date: %s", s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue