Skip to content

Commit

Permalink
suport more format for the parseDateTime function
Browse files Browse the repository at this point in the history
  • Loading branch information
hgiasac committed Nov 7, 2024
1 parent 7b41e67 commit ec59a3b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ func DecodeDateTime(value any, options ...DecodeTimeOption) (time.Time, error) {

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

0 comments on commit ec59a3b

Please sign in to comment.