Opened 5 years ago

Closed 5 years ago

#20045 closed Uncategorized (invalid)

template timezone datetimefields with auto_now_add, auto_now

Reported by: rpq Owned by: nobody
Component: Template system Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The instructions found at ​ indicate that datetime aware fields on a model displayed on a template should automatically display in the current time zone. I use TIME_ZONE set to 'UTC' and change the current time zone with activate() for users in different time zones.

When displaying my DateTimeFields (created_at and updated_at) created with auto_now and auto_now_add, the template displays the datetime fields in UTC regardless of what time zone is set using activate() and localtime filter has no effect on them. All the other DateTimeFields not created with auto_now and auto_now_add are displaying in the template as expected in the current timezone.


Change History (3)

comment:1 Changed 5 years ago by rpq

Version: 1.41.5

I should mention that using the timezone filter to force the conversion works on these datetime fields.

comment:2 Changed 5 years ago by rpq

Please close this as invalid. It turns out user's timezone was not properly set.

comment:3 Changed 5 years ago by rpq

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top