[Django] #23049: Admin DateField doesn't support all DATE_INPUT_FORMATS

10 views
Skip to first unread message

Django

unread,
Jul 17, 2014, 12:23:26 AM7/17/14
to django-...@googlegroups.com
#23049: Admin DateField doesn't support all DATE_INPUT_FORMATS
---------------------------------------+--------------------
Reporter: Patrick Dwyer <pat@…> | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------------+--------------------
According to the documentation formats listed at
[http://docs.python.org/library/datetime.html#strftime-strptime-behavior]
are supported as DATE_INPUT_FORMATS. I have started using the date format
"Thu 17 Jul 2014" represented by '%a %d %b %Y' as my DATE_FORMAT and the
first listed DATE_INPUT_FORMAT but I am having issues on admin pages. The
date picker calendar popups don't work correctly.

On initial page load the date is formatted correctly. When selecting the
17th of July 2014 from the calendar instead of getting "Thu 17 Jul 2014"
the field is populated with "undefined 17 undefined 2014".

Looking at the code in admin/static/js/core.js these are the supported
format characters...

{{{
c: this.toString(),
d: this.getTwoDigitDate(),
H: this.getTwoDigitHour(),
I: this.getTwoDigitTwelveHour(),
m: this.getTwoDigitMonth(),
M: this.getTwoDigitMinute(),
p: (this.getHours() >= 12) ? 'PM' : 'AM',
S: this.getTwoDigitSecond(),
w: '0' + this.getDay(),
x: this.toLocaleDateString(),
X: this.toLocaleTimeString(),
y: ('' + this.getFullYear()).substr(2, 4),
Y: '' + this.getFullYear(),
'%' : '%'
}}}

I think an "almost core" part of Django like admin should support what is
documented or the documentation should be updated to reflect the actual
behaviour.

I'm writing a simple fix for my own use. Although I'd be happy to start
working on a real fix but don't want to waste time if this won't be
considered.

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

Django

unread,
Jul 17, 2014, 12:35:44 AM7/17/14
to django-...@googlegroups.com
#23049: Admin DateField doesn't support all DATE_INPUT_FORMATS
-------------------------------------+-------------------------------------
Reporter: Patrick Dwyer | Owner: nobody
<pat@…> | Status: new
Type: Bug | Version: 1.6
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


Comment:

Without much investigation this could be tricky to implement in a way that
was locale aware (that could be the reason this hasn't been done already).

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

Django

unread,
Jul 17, 2014, 12:59:45 AM7/17/14
to django-...@googlegroups.com
#23049: Admin DateField doesn't support all DATE_INPUT_FORMATS
-------------------------------------+-------------------------------------
Reporter: Patrick Dwyer | Owner: nobody
<pat@…> | Status: new
Type: Bug | Version: 1.6
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by patros):

I've just checked against the current master and stable/1.7.x branches and
they seem to have the same limitation.

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

Django

unread,
Jul 29, 2014, 7:20:54 AM7/29/14
to django-...@googlegroups.com
#23049: Admin DateField doesn't support all DATE_INPUT_FORMATS
-------------------------------------+-------------------------------------
Reporter: Patrick Dwyer | Owner: nobody
<pat@…> | Status: new
Type: Bug | Version: 1.6
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timo):

* stage: Unreviewed => Accepted


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

Django

unread,
Apr 15, 2015, 11:37:59 AM4/15/15
to django-...@googlegroups.com
#23049: Admin DateField doesn't support all DATE_INPUT_FORMATS
-------------------------------------+-------------------------------------
Reporter: Patrick Dwyer | Owner: nobody
<pat@…> |
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* cc: kutenai (added)


Comment:

The latest documentation does not claim that all of the Python date
formats are supported.

There is a specific list of formats supported by default, which does not
include the format you are using.

What documentation leads you to believe that all of the formats should be
supported?

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

Django

unread,
May 30, 2023, 5:38:51 PM5/30/23
to django-...@googlegroups.com
#23049: Admin DateField doesn't support all DATE_INPUT_FORMATS
-------------------------------------+-------------------------------------
Reporter: Patrick Dwyer | Owner: nobody
<pat@…> |
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* cc: Sarah Boyce (added)


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

Django

unread,
Jun 8, 2023, 4:26:19 AM6/8/23
to django-...@googlegroups.com
#23049: Admin DateField doesn't support all DATE_INPUT_FORMATS
-------------------------------------+-------------------------------------
Reporter: Patrick Dwyer | Owner: Sarah
<pat@…> | Boyce
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.6

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 Sarah Boyce):

* owner: nobody => Sarah Boyce
* status: new => assigned
* has_patch: 0 => 1


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

Django

unread,
Jun 9, 2023, 6:20:46 AM6/9/23
to django-...@googlegroups.com
#23049: Admin DateField doesn't support all DATE_INPUT_FORMATS
-------------------------------------+-------------------------------------
Reporter: Patrick Dwyer | Owner: Sarah
<pat@…> | Boyce
Type: Bug | Status: assigned
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* stage: Accepted => Ready for checkin


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

Django

unread,
Jun 9, 2023, 6:58:55 AM6/9/23
to django-...@googlegroups.com
#23049: Admin DateField doesn't support all DATE_INPUT_FORMATS
-------------------------------------+-------------------------------------
Reporter: Patrick Dwyer | Owner: Sarah
<pat@…> | Boyce
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"531f557f9238b8f2e5032e569cf36f0c05bb4043" 531f557]:
{{{
#!CommitTicketReference repository=""
revision="531f557f9238b8f2e5032e569cf36f0c05bb4043"
Fixed #23049 -- Added %a and %A support to Date.strftime.

This enables the admin to display the day as locale's abbreviated/full
name if %a/%A is used in the date format.
}}}

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

Reply all
Reply to author
Forward
0 new messages