Opened 7 years ago
Closed 7 years ago
#30232 closed Bug (fixed)
Correct expected format in invalid DurationField error message
| Reported by: | Aidas Bendoraitis | Owned by: | Adrian Vassallo |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 2.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | yes |
Description
If you enter a duration "14:00" into a duration field, it translates to "00:14:00" which is 14 minutes.
The current error message for invalid DurationField says that this should be the format of durations: "[DD] [HH:[MM:]]ss[.uuuuuu]". But according to the actual behaviour, it should be: "[DD] [[HH:]MM:]ss[.uuuuuu]", because seconds are mandatory, minutes are optional, and hours are optional if minutes are provided.
This seems to be a mistake in all Django versions that support the DurationField.
Also the duration fields could have a default help_text with the requested format, because the syntax is not self-explanatory.
Change History (4)
comment:1 by , 7 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:2 by , 7 years ago
| Has patch: | set |
|---|
comment:3 by , 7 years ago
| Summary: | Correct the error message for the invalid DurationField → Correct expected format in invalid DurationField error message |
|---|---|
| Triage Stage: | Unreviewed → Ready for checkin |
I have created a pull request # 11049.