Opened 6 years ago

Closed 6 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 Adrian Vassallo, 6 years ago

Owner: changed from nobody to Adrian Vassallo
Status: newassigned

comment:2 by Adrian Vassallo, 6 years ago

Has patch: set

I have created a pull request # 11049.

comment:3 by Tim Graham, 6 years ago

Summary: Correct the error message for the invalid DurationFieldCorrect expected format in invalid DurationField error message
Triage Stage: UnreviewedReady for checkin

comment:4 by Tim Graham <timograham@…>, 6 years ago

Resolution: fixed
Status: assignedclosed

In 9681e968:

Fixed #30232 -- Corrected expected format in invalid DurationField error message.

Note: See TracTickets for help on using tickets.
Back to Top