#26711: Aware datetimes rendered through templates are changed to TIME_ZONE
---------------------------------+--------------------------------------
Reporter: aptiko | Owner: nobody
Type: Bug | Status: closed
Component: Template system | Version: 1.9
Severity: Normal | Resolution: invalid
Keywords: timezone | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by charettes):
* keywords: => timezone
* status: new => closed
* resolution: => invalid
Comment:
Aware datetimes are rendered using the current timezone
(`django.utils.timezone.get_current_timezone()`) just like strings marked
for translation are rendered using the current language
(`django.utils.language.get_language()`) by design.
If you want to prevent this conversion to the current timezone you should
use the
[https://docs.djangoproject.com/en/1.9/topics/i18n/timezones/#localtime
localtime] template tag to turn it off.
{{{#!python
{% load tz %}
{% localtime off %}
Take note of this date: {{ adatetime|date:"Y-m-d H:i e (O)" }}
{% endlocaltime %}
}}}
Please reopen the ticket if I missed something.
--
Ticket URL: <https://code.djangoproject.com/ticket/26711#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.05f57b65a1a0b6972a464b0d6955a356%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.