StringToDate: +more RFC3339 forms without TZ colon

Adds a form to handle the common format `strftime("%FT%T%z")`, which
omits the (optional) colon from the timezone. Also adds a matching
T-omitted form.
This commit is contained in:
Ben Orchard 2018-10-21 22:03:01 +02:00 committed by Bjørn Erik Pedersen
parent 8965335b8c
commit 8934aa3ddd

View File

@ -1137,9 +1137,11 @@ func StringToDate(s string) (time.Time, error) {
"2006-01-02 15:04:05.999999999 -0700 MST", // Time.String() "2006-01-02 15:04:05.999999999 -0700 MST", // Time.String()
"2006-01-02", "2006-01-02",
"02 Jan 2006", "02 Jan 2006",
"2006-01-02T15:04:05-0700", // RFC3339 without timezone hh:mm colon
"2006-01-02 15:04:05 -07:00", "2006-01-02 15:04:05 -07:00",
"2006-01-02 15:04:05 -0700", "2006-01-02 15:04:05 -0700",
"2006-01-02 15:04:05Z07:00", // RFC3339 without T "2006-01-02 15:04:05Z07:00", // RFC3339 without T
"2006-01-02 15:04:05Z0700", // RFC3339 without T or timezone hh:mm colon
"2006-01-02 15:04:05", "2006-01-02 15:04:05",
time.Kitchen, time.Kitchen,
time.Stamp, time.Stamp,