Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timezone passing to datetime, since Django 4.2 uses zoneinfo #849

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

vdboor
Copy link
Contributor

@vdboor vdboor commented Jul 18, 2024

This ruff fix previously didn't work on Django 3.2 as that uses pytz. Passing such timezone to datetime causes +00:18 min shifts instead of the expected +01:00 change.

This is caused by the way pytz handles the zoneinfo from history and needs pytz.timezone.localize() to create the proper timezone information. See: https://groups.google.com/g/django-users/c/rXalwEztfr0/m/QAd5bIJubwAJ

@vdboor vdboor force-pushed the diederik/django42-timezone branch from 97479cc to 65e991f Compare July 18, 2024 12:06
Copy link
Contributor

@barrydaniels-nl barrydaniels-nl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@barrydaniels-nl barrydaniels-nl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

This ruff fix previously didn't work on Django 3.2 as that uses pytz.
Passing such timezone to datetime causes +00:18 min shifts instead of
the expected +01:00 change.

This is caused by the way pytz handles the zoneinfo from history and
needs pytz.timezone.localize() to create the proper timezone information.
See: https://groups.google.com/g/django-users/c/rXalwEztfr0/m/QAd5bIJubwAJ
Copy link
Contributor

@barrydaniels-nl barrydaniels-nl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@vdboor vdboor merged commit d883b2a into master Jul 18, 2024
6 checks passed
@vdboor vdboor deleted the diederik/django42-timezone branch July 18, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants