#33867 closed New feature (duplicate)

Automatic detection of timezone in django admin using javascript

Reported by: ldeluigi Owned by: nobody
Component: contrib.admin Version: 4.0
Severity: Normal Keywords: timezone javascript
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Given https://stackoverflow.com/questions/1091372/getting-the-clients-time-zone-and-offset-in-javascript
it seems that you can get the client timezone using javascript for almost all browsers.

This could be used to set a session/cookie with the aforementioned timezone in order to communicate it to a timezone middleware, that runs activate().

Both the middleware and the javascript script could be provided by default by contrib.admin.

The benefit is that by default/for free django-admin would provide its users with properly localized datetimes instead of UTC

Change History (1)

comment:1 by Mariusz Felisiak, 22 months ago

Resolution: duplicate
Status: newclosed

The Django admin uses getTimezoneOffset() since 7e6d852bac4de2d5ed2d5ddeabf71482d644ef51. I think you're talking about timezone-aware widgets 🤔, so it's a duplicate of #29822.

Note: See TracTickets for help on using tickets.
Back to Top