#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/078.ec2dfa19551ceaddd2f65e7db501729f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to