Repository navigation
fix: keep milliseconds in datetime start and end bounds - #752
pcbeingused33 wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughDatetime query bounds now retain millisecond precision. Tests cover UTC-aware, offset-aware, and naive datetime values for both ChangesDatetime bound precision
Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Possibly related PRs
Suggested reviewers: Merge Risk:
|
A
datetimepassed asstartorendto channelhistory()orstats()is truncated to whole seconds. For example,12:00:00.999is sent as...12:00:00.000, so a window ending there leaves out up to 999 ms of results.The cause is that
format_time_paramcomputescalendar.timegm(t.utctimetuple()) * 1000, and a time tuple has no sub-second field. The fix addst.microsecond // 1000. This matches what presencehistory()already sends (_ms_since_epochinably/pubsub/types/presence.py). Naive datetimes are still read as UTC, and non-datetime values are passed through as before.A parametrized test in
test/unit/paginatedresult_test.pycovers UTC, offset-aware and naive datetimes. It fails without the change and passes with it. The paginated result, stats and channel unit tests pass, and ruff is clean.This change was prepared with the help of an AI coding assistant.
Summary by CodeRabbit