Page MenuHomePhabricator

HTMLDateTimeField should leave blank input untouched
Closed, ResolvedPublic

Description

If you use an HTMLDateTimeField form element in a form, leave it blank and submit the form, it will replace the blank value with today's date.

That is presumptuous. If it is a required field, assuming a value for it refutes the purpose of making it required. In one case (see c/315516) it even causes other validation checks to fail.

Instead, if the input is blank, the object's value should also remain blank. It should be left for the code that uses this element to decide what to do with a blank value.

Event Timeline

Huji created this task.Oct 14 2016, 4:26 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 14 2016, 4:26 PM
Huji added a subscriber: Anomie.

Change 315972 had a related patch set uploaded (by Anomie):
HTMLDateTimeField: Properly handle empty input

https://gerrit.wikimedia.org/r/315972

Huji updated the task description. (Show Details)Oct 14 2016, 5:33 PM
matmarex closed this task as Resolved.Oct 14 2016, 6:51 PM
matmarex assigned this task to Anomie.
matmarex removed a project: Patch-For-Review.

Change 315972 merged by jenkins-bot:
HTMLDateTimeField: Properly handle empty input

https://gerrit.wikimedia.org/r/315972