#18768 closed New feature (needsinfo)
Timezone documentation lacks some FAQ about how to deal with naive/tz aware datetimes in the Javascript
Reported by: | Alexey Boriskin | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | timezone, tz |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Timezone documentation provide information about rendering naive and timezone aware datetimes in templates, but lacks some information about working with javascript.
It would be cool if docs answered on questions like:
- Are javascript Date() objects naive or locale-aware?
- How is timezone conversion may be done with javascript?
- How should I populate javascript variable from django template? Is
{% language "en" %} var mydatetime = new Date('{{ mydatetime|date:"r" }}'); {% endlanguage %}
ok or not?
- What about JSON serialized datetimes? Will they be in the correct timezone automagically? What is a "correct" timezone – client's or server's?
Change History (7)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Django does not delve into javascript very deep, but it does: at least it provide some helpers like js catalogue of translated messages. Probably questions are a bit outside of the scope, but maybe documentation can link then to some good source of information about Javascript timezones and django/js interaction in the field of datetimes/timezones?
comment:4 by , 12 years ago
Probably, but not very soon: I'm not the javascript guru and have to understand the domain for myself first.
comment:5 by , 12 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
@void, if you would like to provide a patch at some point, please reopen, thanks!
comment:6 by , 11 years ago
I've been investigating support for time-zones JavaScript in the context of #20663 and the key points are:
- JavaScript doesn't have any support for time zones whatsoever, and even its Date API is... err... well, JavaScript would be better if it didn't exist at all (0-indexed months, WTF?)
- third party libraries are definitely the way to go.
I'm the maintainer of time zone support in Django. As far as I can tell there is some level of time zone awareness in Javascript (
getTimezoneOffset
). In addition you may be using a library such asjskata.timezone.js
. This choice of tools is indpendent of Django.In my opinion, this request is outside of the scope of Django. As a Python web framework, it provides some tools to generate HTML, but it doesn't delve into the JS and CSS land.
If this ticket was accepted, someone else will have to step up and provide a patch, as I don't have the knowledge required to document, recommend or endorse Javascript coding practices.