Opened 15 years ago
Closed 13 years ago
#13437 closed Bug (invalid)
SelectDateField doesn't retain partially posted values when USE_L10N=True
Reported by: | Russell Keith-Magee | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you have localization enabled, and you have a SelectDateField (django.forms.extras.widgets), and you post a year, month and day value, the widget works as advertised.;
However, if you only post partial data (e.g., only the year and month, but *not* the day), the year and month value are not preserved; the widgets are reset to empty values.
This is inconsistent with the unlocalized behavior, which will preserve all available data.
This is because strftime can't format missing values, and strptime can't parse missing values. The parsing failure is turned into a None value for the entire date, rather than retaining partial data in a '2010-04-00' type structure as happens with unlocalized inputs.
Change History (3)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:3 by , 13 years ago
Easy pickings: | unset |
---|---|
Resolution: | → invalid |
Status: | new → closed |
UI/UX: | unset |
In current trunk, partially SelectDateWidget values are not retained, even with USE_L10N=False.
Related issue: #13339, which also requires a reimplementation of strptime to handle L10N edge cases.