openedx / edx-platform

The Open edX LMS & Studio, powering education sites around the world!
https://openedx.org
GNU Affero General Public License v3.0
7.43k stars 3.88k forks source link

Remove the deprecated pytz package #33980

Open UsamaSadiq opened 10 months ago

UsamaSadiq commented 10 months ago

Description

Difference between datetime.timezone and zoneinfo

datetime.timezone and the zoneinfo package are both related to handling time zones in Python, but they serve slightly different purposes and have different use cases.

datetime.timezone

zoneinfo

pytz usages to replace

Potential Solution

Approach 01

Approach 02

iamsobanjaved commented 10 months ago

We will be doing the Python 3.11 upgrade well before the Django 5.2 upgrade, so I think we can opt for second approach, do this after the Python 3.11 upgrade.

iamsobanjaved commented 1 month ago

As we are on Python 3.11, this is unblocked now.

mfarhan943 commented 1 month ago

https://github.com/search?q=repo%3Aopenedx%2Fedx-platform+country_timezones+language%3APython&type=code There isn't a built-in function for country_timezones in the zoneinfo module. To create a custom one, we would need to hardcode a list of countries and their associated timezones.