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

Fixed #28739 -- Fixed get_fixed_timezone() for negative timedeltas.

This commit is contained in:
medmunds
2017-10-24 12:42:44 -07:00
committed by Tim Graham
parent 3576bfe07c
commit d1317edad0
2 changed files with 5 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ utc = pytz.utc
def get_fixed_timezone(offset):
"""Return a tzinfo instance with a fixed offset from UTC."""
if isinstance(offset, timedelta):
offset = offset.seconds // 60
offset = offset.total_seconds() // 60
sign = '-' if offset < 0 else '+'
hhmm = '%02d%02d' % divmod(abs(offset), 60)
name = sign + hhmm