#30578: SelectDateWidget doesn't use DATE formats properly when
settings.USE_L10N=False.
-------------------------------------+-------------------------------------
     Reporter:  fensta               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Forms                |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  Locale,              |             Triage Stage:  Accepted
  SelectDateWidget                   |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * version:  2.2 => master
 * stage:  Unreviewed => Accepted


Comment:

 Thanks for the report. I confirmed that there is an issue with this
 configuration, but I don't think that your patch is correct.
 `get_format()` should be used with and without `USE_L10N`, e.g.
 {{{#!python
 if y is not None and m is not None and d is not None:
     input_format = get_format('DATE_INPUT_FORMATS')[0]
     try:
         date_value = datetime.date(int(y), int(m), int(d))
         date_value = datetime_safe.new_date(date_value)
         return date_value.strftime(input_format)
     except ValueError:
         # Return pseudo-ISO dates with zeros for any unselected values,
         # e.g. '2017-0-23'.
         return '%s-%s-%s' % (y or 0, m or 0, d or 0)
 return data.get(name)
 }}}

 Reproduced at 036362e0cfe74e4ab8a65b99eb2aa9c35371fc04.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30578#comment:1>
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/064.ecb7887be8589667d94dd384ea9aa50d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to