Timezone handling in the Django admin is quite confusing for users when the 
users are in multiple timezones, because everything in the admin site 
operates in the server's time.

Assuming USE_TZ=True, TIME_ZONE='UTC', USE_I18N, USE_L10N, when viewing a 
datetime field, users see the UTC time, with a note below saying "Note: You 
are 7 hours behind server time". This is better than nothing, but with a 
modern browser I believe it's possible to improve the situation. 

The ideal behaviour (I believe) would be localizing the timezones in the 
browser to the user's own time zone, and submitting back to the app using 
TZ-aware timestamp strings. It's possible to pull the TZ unambiguously from 
a modern browser: 
​https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/resolvedOptions#Browser_compatibility#Description
.

```
Intl.DateTimeFormat().resolvedOptions().timeZone
```

Would this approach be acceptable? It seems that we'd want to default to 
the normal behaviour, and perhaps have this as config on the AdminSite 
object (since we want a way to enable this globally for sites that wish to 
use this feature).

(Originally raised here: https://code.djangoproject.com/ticket/29822, 
posting for discussion)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/79896a0e-1338-4267-89bd-9904fca4f0d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to