mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #20693 -- Add timezone support to built-in time filter.
Modified django.utils.dateformat module, moving __init__() method and timezone-related format methods from DateFormat class to TimeFormat base class. Modified timezone-related format methods to return an empty string when timezone is inappropriate for input value.
This commit is contained in:
parent
fa57266699
commit
dd3a883894
3 changed files with 96 additions and 55 deletions
|
@ -360,6 +360,13 @@ def get_filter_tests():
|
|||
# Ticket 19370: Make sure |date doesn't blow up on a midnight time object
|
||||
'date08': (r'{{ t|date:"H:i" }}', {'t': time(0, 1)}, '00:01'),
|
||||
'date09': (r'{{ t|date:"H:i" }}', {'t': time(0, 0)}, '00:00'),
|
||||
# Ticket 20693: Add timezone support to built-in time template filter
|
||||
'time01': (r'{{ dt|time:"e:O:T:Z" }}', {'dt': now_tz_i}, '+0315:+0315:+0315:11700'),
|
||||
'time02': (r'{{ dt|time:"e:T" }}', {'dt': now}, ':' + now_tz.tzinfo.tzname(now_tz)),
|
||||
'time03': (r'{{ t|time:"P:e:O:T:Z" }}', {'t': time(4, 0, tzinfo=FixedOffset(30))}, '4 a.m.::::'),
|
||||
'time04': (r'{{ t|time:"P:e:O:T:Z" }}', {'t': time(4, 0)}, '4 a.m.::::'),
|
||||
'time05': (r'{{ d|time:"P:e:O:T:Z" }}', {'d': today}, ''),
|
||||
'time06': (r'{{ obj|time:"P:e:O:T:Z" }}', {'obj': 'non-datetime-value'}, ''),
|
||||
|
||||
# Tests for #11687 and #16676
|
||||
'add01': (r'{{ i|add:"5" }}', {'i': 2000}, '2005'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue