Repository: go-openapi/strfmt
Pull request #67 (2020-08-24 22:22:09)

Add support for parsing ISO8601 universal sortable date time pattern.

codecov[bot]: # [Codecov](https://codecov.io/gh/go-openapi/strfmt/pull/67?src=pr&el=h1) Report
> Merging [#67](https://codecov.io/gh/go-openapi/strfmt/pull/67?src=pr&el=desc) into [master](https://codecov.io/gh/go-openapi/strfmt/commit/12c26d85a094ca082fe09bf178682b4cc7db1cc3?el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/go-openapi/strfmt/pull/67/graphs/tree.svg?width=650&height=150&src=pr&token=1NsRXHf1sd)](https://codecov.io/gh/go-openapi/strfmt/pull/67?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master      #67   +/-   ##
=======================================
  Coverage   83.43%   83.43%           
=======================================
  Files          10       10           
  Lines        1630     1630           
=======================================
  Hits         1360     1360           
  Misses        198      198           
  Partials       72       72           
```


| [Impacted Files](https://codecov.io/gh/go-openapi/strfmt/pull/67?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [time.go](https://codecov.io/gh/go-openapi/strfmt/pull/67/diff?src=pr&el=tree#diff-dGltZS5nbw==) | `96.19% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/go-openapi/strfmt/pull/67?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/go-openapi/strfmt/pull/67?src=pr&el=footer). Last update [12c26d8...0f31092](https://codecov.io/gh/go-openapi/strfmt/pull/67?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/time.go b/time.go
index 0b2f52d..afd0fb3 100644
--- a/time.go
+++ b/time.go
@@ -63,12 +63,14 @@ const (
 	ISO8601TimeWithReducedPrecision = "2006-01-02T15:04Z"
 	// ISO8601TimeWithReducedPrecision represents a ISO8601 format with reduced precision and no timezone (dropped seconds + no timezone)
 	ISO8601TimeWithReducedPrecisionLocaltime = "2006-01-02T15:04"
+	// ISO8601TimeUniversalSortableDateTimePattern represents a ISO8601 universal sortable date time pattern.
+	ISO8601TimeUniversalSortableDateTimePattern = "2006-01-02 15:04:05"
 	// DateTimePattern pattern to match for the date-time format from http://tools.ietf.org/html/rfc3339#section-5.6
 	DateTimePattern = `^([0-9]{2}):([0-9]{2}):([0-9]{2})(.[0-9]+)?(z|([+-][0-9]{2}:[0-9]{2}))$`
 )
 
 var (
-	dateTimeFormats = []string{RFC3339Micro, RFC3339Millis, time.RFC3339, time.RFC3339Nano, ISO8601LocalTime, ISO8601TimeWithReducedPrecision, ISO8601TimeWithReducedPrecisionLocaltime}
+	dateTimeFormats = []string{RFC3339Micro, RFC3339Millis, time.RFC3339, time.RFC3339Nano, ISO8601LocalTime, ISO8601TimeWithReducedPrecision, ISO8601TimeWithReducedPrecisionLocaltime, ISO8601TimeUniversalSortableDateTimePattern}
 	rxDateTime      = regexp.MustCompile(DateTimePattern)
 	// MarshalFormat sets the time resolution format used for marshaling time (set to milliseconds)
 	MarshalFormat = RFC3339Millis


Test patch:
diff --git a/time_test.go b/time_test.go
index d8bd288..3d08c6b 100644
--- a/time_test.go
+++ b/time_test.go
@@ -32,6 +32,7 @@ var (
 		time time.Time // its representation in time.Time
 		str  string    // its marshalled representation
 	}{
+		{[]byte("2014-12-15 08:00:00"), time.Date(2014, 12, 15, 8, 0, 0, 0, time.UTC), "2014-12-15T08:00:00.000Z"},
 		{[]byte("2014-12-15T08:00:00"), time.Date(2014, 12, 15, 8, 0, 0, 0, time.UTC), "2014-12-15T08:00:00.000Z"},
 		{[]byte("2014-12-15T08:00"), time.Date(2014, 12, 15, 8, 0, 0, 0, time.UTC), "2014-12-15T08:00:00.000Z"},
 		{[]byte("2014-12-15T08:00Z"), time.Date(2014, 12, 15, 8, 0, 0, 0, time.UTC), "2014-12-15T08:00:00.000Z"},