Skip to content

Fix local minute boundaries for offsets containing seconds - #91

Open
mikamikasuki wants to merge 2 commits into
jinzhu:masterfrom
mikamikasuki:fix/local-minute-boundaries
Open

mikamikasuki wants to merge 2 commits into
jinzhu:masterfrom
mikamikasuki:fix/local-minute-boundaries

Conversation

@mikamikasuki

Copy link
Copy Markdown

BeginningOfMinute uses absolute-time truncation, which produces the wrong local minute boundary when a zone offset contains seconds. For example, in Kathmandu in 1900, 12:34:49 becomes 12:34:16; EndOfMinute then extends into the next local minute.

Remove the local seconds before truncating subsecond precision. This retains the input location and the selected occurrence of a repeated daylight-saving minute. If doing so crosses an offset change, retain the existing boundary for that partial minute.

Ten regression cases cover positive and negative second-based offsets, historical Kathmandu, an existing minute boundary, ordinary offsets, both occurrences of a repeated New York minute, and partial minutes around the Algiers offset change in 1891. Four cases fail before the fix, for both beginning and end boundaries.

Validation: full tests on Go 1.16.15, 1.23.12 and 1.27.1; race tests on 1.23 and 1.27; shuffled tests on 1.27; and go vet pass. Golangci-lint reports no added findings; its three full-suite findings also occur on the base revision. Separate checks cover every second-based fixed offset within ±24 hours and historical IANA transition boundaries.

Prepared with AI assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant