go-yaml / yaml

YAML support for the Go language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid date-time format during marshalling returns unquoted value. Expecting quoted value.

Akashr7n opened this issue · comments

(Below is example without 'Z')
Actual:
date: 2020-04-15T00:00:00

Expecting:
date: '2020-04-15T00:00:00'

@rogpeppe / @niemeyer Could you please help look into this. Am I expecting anything wrong?

time.Time implements encoding.TextUnmarshaler and encoding.TextMarshaler as unquoted RFC3339 (see source): https://go.dev/play/p/91Czuy75Xwl.
Why would you expect it to be quoted?

Marshaling/unmarshaling Works fine with v3: https://go.dev/play/p/9dGIFChLTDs.
Also, 2020-04-15T00:00:00 is not a valid RFC3339 timestamp https://go.dev/play/p/RtIEqzhnNRQ.