Skip to content

Commit

Permalink
使用字符串(1.19不支持)
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Oct 31, 2023
1 parent 28519c5 commit 03e558f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parse/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func Convert[T any](source any, defVal T) T {
}

// 转time.Time
layouts := []string{time.DateTime, time.DateOnly, time.RFC3339}
layouts := []string{"2006-01-02 15:04:05", "2006-01-02", "2006-01-02T15:04:05Z07:00"}
if types.IsTime(defValType) {
for _, layout := range layouts {
parse, err := time.ParseInLocation(layout, source.(string), time.Local)
Expand Down

0 comments on commit 03e558f

Please sign in to comment.