Skip to content

time: Parse(..) should use year 1 when no year is given to match the time.Time zero value #29840

@fsmv

Description

@fsmv

What version of Go are you using (go version)?

$ go version
go version go1.10.3 linux/arm

What did you do?

https://play.golang.org/p/_WyGwuxEAhL

What did you expect to see?

time.Parse(..) should set year to 1, like the zero value of time.Time, when year is omitted from the layout string.

What did you see instead?

time.Parse(..) sets the year to 0, so you can't compare with the zero value of time.Time, when the year is omitted from the layout string.

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