Add jetstream direct get timestamp parsing#810
Open
oliverlambson wants to merge 1 commit intonats-io:mainfrom
Open
Add jetstream direct get timestamp parsing#810oliverlambson wants to merge 1 commit intonats-io:mainfrom
oliverlambson wants to merge 1 commit intonats-io:mainfrom
Conversation
wallyqs
pushed a commit
to wallyqs/nats.py
that referenced
this pull request
Jan 26, 2026
Add comprehensive unit tests for the ISO 8601 datetime parsing utility function introduced in PR nats-io#810. These tests cover: - Standard UTC timestamps with Z suffix - Timestamps with microsecond and nanosecond precision - Fractional second trimming (nanoseconds to microseconds) - Different timestamp formats (Z vs +00:00 offset) - Edge cases (midnight, end of day) - Python version compatibility (< 3.11 vs >= 3.11) This test file validates the _parse_iso_dt function that enables js.get_msg(..., direct=True) to properly populate RawStreamMsg.time from the Nats-Time-Stamp header.
oliverlambson
commented
Jan 26, 2026
| # Trim fractional seconds to 6 digits | ||
| date_part, frac_tz = time_string.split(".", 1) | ||
| frac, tz = frac_tz.split("+") | ||
| frac = frac[:6] # keep only microseconds |
Contributor
Author
There was a problem hiding this comment.
i kept this as-is, but it's worth noting the proposed changes to this logic in #796 (i.e., this may contain a pre-existing bug)
cf44191 to
801e72c
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.
Closes #809