Skip to content

Use ZoneInfo as primary source of timezone data #8924

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

Merged
merged 2 commits into from
Apr 8, 2023

Conversation

max-muoto
Copy link
Contributor

@max-muoto max-muoto commented Apr 2, 2023

Note: Before submitting this pull request, please review our contributing guidelines.

Description

This PRs switches over to ZoneInfo as the primary source of timezone data in DRF. This PR accomplishes several things:

  • Adds deprecation warning for a test that relies off pytz.
  • Switches over tests that do not rely on pytz functionality over to ZoneInfo.
  • Add additional error handling for ZoneInfo timezones. This is because unlike pytz, error checking has to be done more or less manually in able to determine ambiguous and imaginary timezones (see this doc on migrating to ZoneInfo). We previously had exception handling in DateTimeField for pytz errors, but I added manually checking that will cover ZoneInfo timezones.

Django will provide us ZoneInfo instances as long as USE_DEPRECATED_PYTZ is not enabled

Fixes #8577

@max-muoto max-muoto marked this pull request as ready for review April 2, 2023 19:09
@auvipy auvipy self-requested a review April 3, 2023 07:21
@auvipy
Copy link
Member

auvipy commented Apr 3, 2023

thanks for being the go-to guy for zoneinfo migration in several packages I maintain//co-maintain :D

@auvipy auvipy added this to the 3.15 milestone Apr 8, 2023
@auvipy auvipy merged commit 62abf6a into encode:master Apr 8, 2023
@deronnax
Copy link
Contributor

could not we remove the requirement on pytz?

@cracly
Copy link

cracly commented Dec 2, 2023

Hey, is there any progress on this pull request and the underlying issue? I would like to get rid of pytz. Thanks!

@deronnax
Copy link
Contributor

deronnax commented Dec 3, 2023

it's has been done months ago #8984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to using built-in zoneinfo in favour of pytz
4 participants