Skip to content

Commit ebdf160

Browse files
authored
utils: support more formats for the parseDateTime function (#167)
1 parent 7b41e67 commit ebdf160

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/decode.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ func DecodeDateTime(value any, options ...DecodeTimeOption) (time.Time, error) {
10861086

10871087
// parse date time with fallback ISO8601 formats.
10881088
func parseDateTime(value string) (time.Time, error) {
1089-
for _, format := range []string{time.RFC3339, "2006-01-02T15:04:05Z0700", "2006-01-02T15:04:05-0700", time.RFC3339Nano} {
1089+
for _, format := range []string{time.RFC3339, "2006-01-02T15:04:05Z0700", "2006-01-02T15:04:05-0700", time.RFC3339Nano, "2006-01-02T15:04:05", "2006-01-02 15:04:05", time.DateOnly} {
10901090
result, err := time.Parse(format, value)
10911091
if err != nil {
10921092
continue

0 commit comments

Comments
 (0)