1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #22598 -- Allowed make_aware() to work with ambiguous datetime

This commit is contained in:
Josh Smeaton
2015-03-31 16:58:37 +11:00
committed by Tim Graham
parent 269a5dbdd3
commit 143255c8bb
4 changed files with 59 additions and 5 deletions

View File

@@ -347,7 +347,7 @@ def is_naive(value):
return value.tzinfo is None or value.tzinfo.utcoffset(value) is None
def make_aware(value, timezone=None):
def make_aware(value, timezone=None, is_dst=None):
"""
Makes a naive datetime.datetime in a given time zone aware.
"""
@@ -355,7 +355,7 @@ def make_aware(value, timezone=None):
timezone = get_current_timezone()
if hasattr(timezone, 'localize'):
# This method is available for pytz time zones.
return timezone.localize(value, is_dst=None)
return timezone.localize(value, is_dst=is_dst)
else:
# Check that we won't overwrite the timezone of an aware datetime.
if is_aware(value):