From e85dcc8b3809ddf4afe858d2ee084c0c82749732 Mon Sep 17 00:00:00 2001 From: Valera Date: Wed, 16 Sep 2020 23:01:43 +0300 Subject: [PATCH] [bugfix] parse unix timestamp to time.Time from string Fixing https://github.com/spf13/cast/issues/102 --- caste.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/caste.go b/caste.go index 9ac1015..af9e9bc 100644 --- a/caste.go +++ b/caste.go @@ -1273,6 +1273,10 @@ func parseDateWith(s string, dates []string) (d time.Time, e error) { 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) }