Repository navigation
Fix strptime rejecting the zero time instant - #333
Merged
Merged
Conversation
itchyny
approved these changes
Nov 1, 2026
W-Floyd
added a commit
to modopayments/gojq
that referenced
this pull request
Nov 4, 2026
Replaces the builtin.jq fraction split. time.Parse takes any fraction (. or ,) and Z, +hh:mm or +hhmm offsets, and the zero-time rejection now lives here rather than in strptime (upstream itchyny#333 drops it there). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
W-Floyd
added a commit
to modopayments/gojq
that referenced
this pull request
Nov 4, 2026
Parse with time.Parse instead of strptime: RFC 3339 allows a fraction (. or ,), which strptime's %f caps at 6 digits. +hhmm offsets still parse. The zero-time rejection moves here from strptime, which upstream itchyny#333 drops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
"0001-01-01T00:00:00Z" | strptime("%Y-%m-%dT%H:%M:%S%z")currently fails even though the underlying parser successfully parses the timestamp. It equals Go's zerotime.Time, which is also a valid instant.Remove the zero-time rejection and rely on the parser's error result. The CLI regression covers UTC midnight, the same instant with a +0100 offset, and a neighboring second.
go test ./... -count=1passes on windows/amd64 and windows/386 with Go 1.27.3.go vet ./..., gofmt and the project's staticcheck invocation pass.