Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #20693 -- Add timezone support to built-in time filter. #1327

Merged
merged 1 commit into from Aug 26, 2013
Merged

Fixed #20693 -- Add timezone support to built-in time filter. #1327

merged 1 commit into from Aug 26, 2013

Conversation

wsmith323
Copy link
Contributor

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.

# Ticket 20693: Add timezone support to built-in time template filter
'time01': (r'{{ dt|time:"P:e:O:T:Z" }}', {'dt': datetime(2013, 7, 2, 4, 0, tzinfo=FixedOffset(30))}, '4 a.m.:+0030:+0030:+0030:1800'),
'time02': (r'{{ dt|time:"P:e:O:T:Z" }}', {'dt': datetime(2013, 7, 2)}, 'midnight::-0500:CDT:-18000'),
'time03': (r'{{ t|time:"P:e:O:T:Z" }}', {'t': time(4, 0, tzinfo=FixedOffset(30))}, '4 a.m.::::'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is datetime.date covered elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a test for datetime.date. The results are not any different than for any other object that doesn't contain time information, but it is better to handle that case explicitly.

I also realized that the time02 test contained success criteria that was not portable. I have fixed that.

@estebistec
Copy link

Sorry for the late comment. It is my belief that after this change it would be ready for checkin (and I'll mark it as such).

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.
@carljm carljm merged commit dd3a883 into django:master Aug 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants