Repository navigation
Conversation
staktrace
requested changes
Nov 21, 2026
Move the Timezone arm into a shared helper with no behavior change.
staktrace-bot
force-pushed
the
fix-dateparse-optional-seconds-and-fws
branch
from
November 21, 2026 18:49
2aec4b5 to
d5b701e
Compare
staktrace
approved these changes
Nov 21, 2026
added 2 commits
November 21, 2026 14:03
RFC 5322 section 3.3 makes seconds optional in the time production (hour ":" minute [":" second]). The Second state previously always parsed the next token as u8 seconds, so a numeric zone like +0100 was read as 100 seconds and zones like -0500 or GMT failed. Only treat a token of one or two ASCII digits as seconds; otherwise handle the token as a timezone. Add tests for the issue staktrace#154 cases.
RFC 5322 folding whitespace (FWS) in Date fields can include tabs and CRLF, but dateparse only split on spaces and colons, so dates with tabs failed to parse (issue staktrace#154). Also split on tab, CR, and LF, and test a tab-separated date against its space-separated equivalent.
staktrace-bot
force-pushed
the
fix-dateparse-optional-seconds-and-fws
branch
from
November 21, 2026 19:04
d5b701e to
6d8df38
Compare
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.
dateparse had two RFC 5322 Date parsing bugs from #154.
hour ":" minute [":" second]). The Second state always parsed the next token as u8 seconds, so+0100was read as 100 seconds and zones like-0500orGMTfailed. A token is now treated as seconds only if it is one or two ASCII digits; otherwise it is handled as the timezone.Fixes #154