- π¨π¦Canada mdolnik
The original merged in fix for this issue is not sufficient as it will still cause a validation error when the time is set to midnight as the value resolves to
0
which is treated as empty by Drupal core.The original patch supplied in comment
#5
had logic inTimeElement::valueCallback()
which cast the return value as a string which is missing from both the current1.x
and2.x
branches.This string cast is necessary to avoid
FormValidator::doValidateForm()
from considering midnight to be empty.
ie: the line with$is_empty_value = ($elements['#value'] === 0);
will treat0
(midnight) as an empty value where-as it will treat'0'
as populated.Regardless I believe the updated patch in
#9
should work for anyone needing this fix in1.x
and for2.x
there is an open issue 3227128 π Time Field fails required field validation if value is 00:00 Needs work which I think should be used to resolve this in version2.x
.