Modified time properties json encoding to match xsd:timeDate format

Namely switching from the default behavior of time.Time.MarshalJSON, which uses RFC3339Nano to plain RFC3339
This commit is contained in:
mariusor 2021-03-26 10:56:23 +01:00
parent 116119148d
commit 6f428a28ab

View file

@ -80,10 +80,11 @@ func writeFloatJSONProp(b *[]byte, n string, f float64) (notEmpty bool) {
}
func writeTimeJSONProp(b *[]byte, n string, t time.Time) (notEmpty bool) {
if v, err := t.UTC().MarshalJSON(); err == nil {
return writeJSONProp(b, n, v)
}
return false
var tb []byte
write(&tb, '"')
writeS(&tb, t.UTC().Format(time.RFC3339))
write(&tb, '"')
return writeJSONProp(b, n, tb)
}
func writeDurationJSONProp(b *[]byte, n string, d time.Duration) (notEmpty bool) {