d98b8ffe43a18c9b01384fa80be8d25caa87f88e
Context.Time applied the parsed month while the day was still the one of the reference date. When that day does not exist in the target month, time.Date normalizes it forward, so "september 5th" parsed on the 31st of October resolved to the 5th of October. The parsed day was only applied afterwards, to the already wrong month. Clamp the reference day to the last day of the target month before switching the month. The parsed day still overwrites it afterwards, so the ordering of the branches in Context.Time is unchanged. The existing fixtures pin the reference date to 2016-01-06 and the 6th exists in every month, so the overflow never triggered. Add a regression test that parses against 2016-10-31. Fixes #12
Description
My contributions to olebedev/when: 4 commits, 1 merged PRs
46 KiB
0 Stars
1 Watchers
0 Forks
Languages
Go
100%