[Django] #18767: Admin's calendar for datetime fields doesn't show right values with russian and some other locales

13 views
Skip to first unread message

Django

unread,
Aug 14, 2012, 1:58:49 PM8/14/12
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+--------------------
Reporter: void | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
The problem is within
[[https://github.com/django/django/blob/master/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js#L220|following
lines]]:
{{{
if (inp.value) {
var date_parts = inp.value.split('-');
var year = date_parts[0];
var month = parseFloat(date_parts[1]);
if (year.match(/\d\d\d\d/) && month >= 1 && month <= 12) {
DateTimeShortcuts.calendars[num].drawDate(month, year);
}
}
}}}
These lines assume that date format is `YYYY-mm-dd`, which is not true for
many locales.

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

Django

unread,
Aug 19, 2012, 3:10:37 PM8/19/12
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+--------------------------------------
Reporter: void | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by void):

* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0


Comment:

Pull request: [https://github.com/django/django/pull/294]

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

Django

unread,
Aug 20, 2012, 9:42:41 AM8/20/12
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+--------------------------------------
Reporter: void | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by anonymous):

I do not have that problem, describe the regional settings that are
installed on your system.

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:2>

Django

unread,
Aug 20, 2012, 10:57:26 AM8/20/12
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+--------------------------------------
Reporter: void | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by void):

I believe it's enough to have `LANGUAGE_CODE = 'ru-ru'` in the
`settings.py`

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:3>

Django

unread,
Aug 28, 2012, 5:11:35 PM8/28/12
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+--------------------------------------
Reporter: void | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by apollo13):

* cc: apollo13 (added)


Comment:

Please describe what you see (probably with a screenshot) and what's wrong
there, putting 'ru-ru' as LANGUAGE_CODE doesn't seem to break anything for
me…

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:4>

Django

unread,
Aug 28, 2012, 5:21:56 PM8/28/12
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+--------------------------------------
Reporter: void | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by anonymous):

Ok, maybe I was not so clear in the description of this ticket.
Let's make django model with `DateTimeField` and register it with django
admin. You'll see something like this:
[http://dl.dropbox.com/u/302516/Screenshots/usualform.png]. Date is in
format `01.02.1986`, which means it's 1st of February of 1986.
Then click on the calendar icon and we'll see calendar popup:
[http://dl.dropbox.com/u/302516/Screenshots/r.png]. But the popup is
rendered for August 2012 (as you may see in the title: `Август 2012`). If
I'd switch my `LANGUAGE_CODE` to `'en-us'`, I see that calendar popup
renders correct month:
[http://dl.dropbox.com/u/302516/Screenshots/correct.png].

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:5>

Django

unread,
Sep 8, 2012, 9:50:57 AM9/8/12
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------
Reporter: void | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by tswicegood):

* stage: Unreviewed => Accepted


Comment:

I was able to reproduce this.

The issue is that the calendar should display for the month/year of the
date that is set. Steps to reproduce:

* Set calendar date to February 1, 2000 (Russian date is 01.02.2000)
* Click the calendar icon
* Excepted behavior: Calendar is set to February 2000
* Actual behavior: Calendar is set to whatever it last was

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:6>

Django

unread,
Mar 1, 2014, 7:39:32 AM3/1/14
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------

Reporter: void | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timo):

* needs_better_patch: 0 => 1


Comment:

Patch no longer applies cleanly.

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:7>

Django

unread,
Apr 15, 2014, 10:48:11 AM4/15/14
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------
Reporter: void | Owner: maxocub
Type: Bug | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by maxocub):

* status: new => assigned
* owner: nobody => maxocub


--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:8>

Django

unread,
Apr 15, 2014, 3:49:02 PM4/15/14
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------
Reporter: void | Owner: maxocub
Type: Bug | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by maxocub):

My PR: https://github.com/django/django/pull/2560

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:9>

Django

unread,
Apr 15, 2014, 3:49:23 PM4/15/14
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------
Reporter: void | Owner: maxocub
Type: Bug | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by maxocub):

* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:10>

Django

unread,
Apr 22, 2014, 10:39:44 AM4/22/14
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------
Reporter: void | Owner: maxocub
Type: Bug | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by maxocub):

This [https://github.com/django/django/pull/2560 PR] needs to be reviewed
please.

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:11>

Django

unread,
Apr 22, 2014, 11:02:08 PM4/22/14
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------
Reporter: void | Owner: maxocub
Type: Bug | Status: assigned
Component: contrib.admin | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by maxocub):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:12>

Django

unread,
Aug 13, 2014, 8:37:02 PM8/13/14
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------
Reporter: void | Owner: maxocub
Type: Bug | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"25e06bca57c068d4b9e9b4221b16a667ccb0d38e"]:
{{{
#!CommitTicketReference repository=""
revision="25e06bca57c068d4b9e9b4221b16a667ccb0d38e"
Fixed #18767 -- Fixed admin calendar for other locales than English.

Refactored openCalendar function from DateTimeShortcuts.js. Now, when
entered manually in the input field, the date will show up correctly on
the calendar for locales that don't use "-" for separator.

Thanks charettes for revivew and Alexey Boriskin for some of the patch.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:13>

Django

unread,
Aug 14, 2014, 4:47:19 AM8/14/14
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------
Reporter: void | Owner: maxocub
Type: Bug | Status: closed
Component: contrib.admin | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by claudep):

I just noticed that the test might add ~30 seconds to the test suite. Is
testing every language really mandatory in this case?

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:14>

Django

unread,
Aug 14, 2014, 7:40:25 AM8/14/14
to django-...@googlegroups.com
#18767: Admin's calendar for datetime fields doesn't show right values with russian
and some other locales
-------------------------------+------------------------------------
Reporter: void | Owner: maxocub
Type: Bug | Status: closed
Component: contrib.admin | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by maxocub):

I guess we could only test the 4 or 5 different types of date format.

--
Ticket URL: <https://code.djangoproject.com/ticket/18767#comment:15>

Reply all
Reply to author
Forward
0 new messages