Skip to content

time: handle >4-digit or negative years in MarshalJSON, UnmarshalJSON #4556

@agoode

Description

@agoode
RFC3339 format for time.Time JSON translation is insufficient. The Google APIs will
happily output >4 digit years for such dates in the far future. For dates before year
0, negative values are produced. Dates in the far past also have more than 4 digits.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
http://play.golang.org/p/QkymcrE2sX

1. Try to marshal or unmarshal a date outside of the year range [0,9999]


What is the expected output?
Valid interchange.


What do you see instead?
Errors.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Linux

Which version are you using?  (run 'go version')
go1.0.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions