Skip to content

Commit

Permalink
[3.0.x] Fixed #27921 -- Clarified usage of make_aware() with is_dst a…
Browse files Browse the repository at this point in the history
…rgument.

Backport of c2678e4 from master
  • Loading branch information
paqman85 authored and felixxm committed Sep 27, 2019
1 parent 49dcb5d commit 311177d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions docs/ref/utils.txt
Original file line number Diff line number Diff line change
Expand Up @@ -972,11 +972,14 @@ appropriate entities.
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
(when entering into DST). Setting ``is_dst`` to ``True`` or ``False`` will
avoid the exception by moving the hour backwards or forwards by 1
respectively. For example, ``is_dst=True`` would change a nonexistent
time of 2:30 to 1:30 and ``is_dst=False`` would change the time to 3:30.
``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).

.. function:: make_naive(value, timezone=None)

Expand Down

0 comments on commit 311177d

Please sign in to comment.