[Django] #33867: Automatic detection of timezone in django admin using javascript

13 views
Skip to first unread message

Django

unread,
Jul 25, 2022, 7:12:40 PM7/25/22
to django-...@googlegroups.com
#33867: Automatic detection of timezone in django admin using javascript
-------------------------------------+-------------------------------------
Reporter: ldeluigi | Owner: nobody
Type: New | Status: new
feature |
Component: | Version: 4.0
contrib.admin |
Severity: Normal | Keywords: timezone javascript
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/33867>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 26, 2022, 1:16:45 AM7/26/22
to django-...@googlegroups.com
#33867: Automatic detection of timezone in django admin using javascript
-------------------------------------+-------------------------------------
Reporter: ldeluigi | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution: duplicate

Keywords: timezone javascript | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/33867#comment:1>

Reply all
Reply to author
Forward
0 new messages