- last update
over 1 year ago 7 pass - π¨π¦Canada mdolnik
This issue should have been resolved in Time Field fails required field validation if value is 12:00 AM π Time Field fails required field validation if value is 12:00 AM Fixed but the merged in fix missed a certain part of the provided patches.
The validation error is caused when the time is set to midnight as the value resolves to
0
which is treated as empty by Drupal core.This is resolved by modifying
TimeElement::valueCallback()
to cast the return value as a string.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. - Status changed to Needs work
over 1 year ago 11:04am 31 August 2023 - π§πͺBelgium BramDriesen Belgium π§πͺ
Thanks for the details answer and patch! Really helps when validating even a trivial patch like this. As far for the patch itself, it looks RTBC to me, but I think it should be easy to write a test case for this. I'll see if I find the time for that, or if someone else beats me to it π
- π§πͺBelgium andreasderijcke Antwerpen / Gent
Just confirming this patch works.
- π§πͺBelgium andreasderijcke Antwerpen / Gent
Sorry, target version should be 2.x-dev. Patch still works on current latest commit (https://git.drupalcode.org/project/time_field/-/commit/24b503688ad0bb27b...)
- Status changed to Needs review
10 months ago 9:58am 22 February 2024 - last update
10 months ago 16 pass - πΊπ¦Ukraine sickness29
Rerolled patch from #2 and added Functional test for time field which checks the field with couple values
- last update
10 months ago 11 pass, 2 fail The last submitted patch, 8: empty_validation-3227128-7-testonly.patch, failed testing. View results β
- Status changed to RTBC
10 months ago 12:44pm 22 February 2024 -
BramDriesen β
committed 3eec1c58 on 2.x
Issue #3227128 by BramDriesen, sickness29, mdolnik, zanvidmar,...
-
BramDriesen β
committed 3eec1c58 on 2.x
- Status changed to Fixed
10 months ago 12:53pm 22 February 2024 Automatically closed - issue fixed for 2 weeks with no activity.