Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
time: AddDate(0, 0, 1) gives the same exact day in Samoa edge case #29602
What version of Go are you using (
Icann refers to this behavior as the "date line correction" which is not implemented by the time package. For dates before the timezone creation, it defaults to UTC-10 in Pacific. The same behavior can be observed for Kiribati new timezone "Pacific/Kiritimati" which was created on 30 Dec 1994, i.e. next day is 1 Jan 1995 only at 10 AM..
When given a non-existent timestamp, the time package has to fallback to a valid date somehow. This is also true for smaller jumps (like 1 hour). Since 2011-12-30 is Samoa does not exists, we fallback to the nearest valid dates (12-29 and 12-31).
This is documented in the Date and AddDate descriptions:
Since this behaviour is expected and documented, I think we can close this issue.