mirror of
https://github.com/django/django.git
synced 2024-12-25 02:26:12 +00:00
Followed a best practice in the time zones docs.
Prevented localize from swallowing non existent or ambiguous datetimes.
This commit is contained in:
parent
38408f8007
commit
4b58e94f27
@ -656,7 +656,7 @@ Usage
|
|||||||
>>> from django.utils.dateparse import parse_datetime
|
>>> from django.utils.dateparse import parse_datetime
|
||||||
>>> naive = parse_datetime("2012-02-21 10:28:45")
|
>>> naive = parse_datetime("2012-02-21 10:28:45")
|
||||||
>>> import pytz
|
>>> import pytz
|
||||||
>>> pytz.timezone("Europe/Helsinki").localize(naive)
|
>>> pytz.timezone("Europe/Helsinki").localize(naive, is_dst=None)
|
||||||
datetime.datetime(2012, 2, 21, 10, 28, 45, tzinfo=<DstTzInfo 'Europe/Helsinki' EET+2:00:00 STD>)
|
datetime.datetime(2012, 2, 21, 10, 28, 45, tzinfo=<DstTzInfo 'Europe/Helsinki' EET+2:00:00 STD>)
|
||||||
|
|
||||||
Note that ``localize`` is a pytz extension to the :class:`~datetime.tzinfo`
|
Note that ``localize`` is a pytz extension to the :class:`~datetime.tzinfo`
|
||||||
|
Loading…
Reference in New Issue
Block a user