Skip to content

time: change values set at year-month layout #30075

@tredoe

Description

@tredoe

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

$ go version
go version go1.11.5 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

Set a year-month layout with a day to zero.
https://play.golang.org/p/NYVZhLzzicL

What did you expect to see?

When I set a time to time.Date(2010, time.January, 0, 0, 0, 0, 0, time.UTC), I expected to see 2010-01-01 00:00:00 +0000 UTC

What did you see instead?

2009-12-31 00:00:00 +0000 UTC

So, to get a valid date, it changes both year and month -which had been set by me-, instead of changing the day value to 1.

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