relvacode / iso8601

A fast ISO8601 date parser for Go
MIT License
144 stars 16 forks source link

FIX issue with the time set to zero #1

Closed ritoon closed 6 years ago

ritoon commented 6 years ago

After paring a date with this value "0000-00-00" internally the date is looking like -0001-12-31 00:00:00 +0000 UTC so for the round trip json Unmarshal/Marshal you can get this current error : json: error calling MarshalJSON for type iso8601.Time: Time.MarshalJSON: year outside of range [0,9999]

To keep is safe I use the default zeroed time of Go witch is 0001-01-01 00:00:00 +0000 UTC

ritoon commented 6 years ago

example of zeroed time : https://play.golang.org/p/7PyyidV8XAL

relvacode commented 6 years ago

Looks good, thanks!