diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/utils.txt | 31 | ||||
| -rw-r--r-- | docs/releases/3.2.txt | 3 | ||||
| -rw-r--r-- | docs/topics/i18n/timezones.txt | 14 |
3 files changed, 31 insertions, 17 deletions
diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index 921aba5de8..ce3a4cba03 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -987,21 +987,24 @@ appropriate entities. :class:`~datetime.datetime`. If ``timezone`` is set to ``None``, it defaults to the :ref:`current time zone <default-current-time-zone>`. - The ``pytz.AmbiguousTimeError`` exception is raised if you try to make - ``value`` aware during a DST transition where the same time occurs twice - (when reverting from DST). Setting ``is_dst`` to ``True`` or ``False`` will - avoid the exception by choosing if the time is pre-transition or - post-transition respectively. + When using ``pytz``, the ``pytz.AmbiguousTimeError`` exception is raised if + you try to make ``value`` aware during a DST transition where the same time + occurs twice (when reverting from DST). Setting ``is_dst`` to ``True`` or + ``False`` will avoid the exception by choosing if the time is + pre-transition or post-transition respectively. - The ``pytz.NonExistentTimeError`` exception is raised if you try to make - ``value`` aware during a DST transition such that the time never occurred. - For example, if the 2:00 hour is skipped during a DST transition, trying to - make 2:30 aware in that time zone will raise an exception. To avoid that - you can use ``is_dst`` to specify how ``make_aware()`` should interpret - such a nonexistent time. If ``is_dst=True`` then the above time would be - interpreted as 2:30 DST time (equivalent to 1:30 local time). Conversely, - if ``is_dst=False`` the time would be interpreted as 2:30 standard time - (equivalent to 3:30 local time). + When using ``pytz``, the ``pytz.NonExistentTimeError`` exception is raised + if you try to make ``value`` aware during a DST transition such that the + time never occurred. For example, if the 2:00 hour is skipped during a DST + transition, trying to make 2:30 aware in that time zone will raise an + exception. To avoid that you can use ``is_dst`` to specify how + ``make_aware()`` should interpret such a nonexistent time. If + ``is_dst=True`` then the above time would be interpreted as 2:30 DST time + (equivalent to 1:30 local time). Conversely, if ``is_dst=False`` the time + would be interpreted as 2:30 standard time (equivalent to 3:30 local time). + + The ``is_dst`` parameter has no effect when using non-``pytz`` timezone + implementations. .. function:: make_naive(value, timezone=None) diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index 2182618a7b..d3d3f44b8e 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -657,6 +657,9 @@ MySQL 5.7 and higher. Miscellaneous ------------- +* Django now supports non-``pytz`` time zones, such as Python 3.9+'s + :mod:`zoneinfo` module and its backport. + * The undocumented ``SpatiaLiteOperations.proj4_version()`` method is renamed to ``proj_version()``. diff --git a/docs/topics/i18n/timezones.txt b/docs/topics/i18n/timezones.txt index 367835a247..ab8902b0cd 100644 --- a/docs/topics/i18n/timezones.txt +++ b/docs/topics/i18n/timezones.txt @@ -26,8 +26,15 @@ to this problem is to use UTC in the code and use local time only when interacting with end users. Time zone support is disabled by default. To enable it, set :setting:`USE_TZ = -True <USE_TZ>` in your settings file. Time zone support uses pytz_, which is -installed when you install Django. +True <USE_TZ>` in your settings file. By default, time zone support uses pytz_, +which is installed when you install Django; Django also supports the use of +other time zone implementations like :mod:`zoneinfo` by passing +:class:`~datetime.tzinfo` objects directly to functions in +:mod:`django.utils.timezone`. + +.. versionchanged:: 3.2 + + Support for non-``pytz`` timezone implementations was added. .. note:: @@ -680,7 +687,8 @@ Usage pytz_ provides helpers_, including a list of current time zones and a list of all available time zones -- some of which are only of historical - interest. + interest. :mod:`zoneinfo` also provides similar functionality via + :func:`zoneinfo.available_timezones`. .. _pytz: http://pytz.sourceforge.net/ .. _more examples: http://pytz.sourceforge.net/#example-usage |
