Skip to content

fix: convert aware expiration datetimes to UTC - #424

Merged
alessio-locatelli merged 1 commit into
requests-cache:mainfrom
alessio-locatelli:fix_aware_expiration_datetimes
Oct 7, 2026
Merged

alessio-locatelli merged 1 commit into
requests-cache:mainfrom
alessio-locatelli:fix_aware_expiration_datetimes

Conversation

@alessio-locatelli

Copy link
Copy Markdown
Collaborator

convert_to_utc_naive() discarded the result of astimezone() and only stripped tzinfo, so an aware datetime with a non-UTC offset kept its local wall-clock time. Since internal datetimes are naive UTC, an expire_after of 12:00+02:00 expired at 12:00 UTC instead of 10:00 UTC.

convert_to_utc_naive() discarded the result of astimezone() and only
stripped tzinfo, so an aware datetime with a non-UTC offset kept its
local wall-clock time. Since internal datetimes are naive UTC, an
`expire_after` of 12:00+02:00 expired at 12:00 UTC instead of 10:00 UTC.
@alessio-locatelli
alessio-locatelli merged commit f23b974 into requests-cache:main Oct 7, 2026
8 checks passed
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