Skip to content

Commit 3e92191

Browse files
committed
Enhance date widget value validation
Update validation logic for the date widget to check for both null and empty string values. This ensures a date is only assigned when the input is strictly non-null and contains data.
1 parent 035138d commit 3e92191

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Contao/Widgets/MultiColumnWizard.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,10 @@ protected function initializeWidget(&$arrField, $intRow, $strKey, $varValue)
12511251
// Convert date formats into timestamps (check the eval setting first -> #3063)
12521252
$rgxp = ($arrField['eval']['rgxp'] ?? '');
12531253
$dateFormatErrorMsg = '';
1254-
if (($rgxp === 'date' || $rgxp === 'time' || $rgxp === 'datim') && $varValue !== '') {
1254+
if (
1255+
($rgxp === 'date' || $rgxp === 'time' || $rgxp === 'datim')
1256+
&& ($varValue !== '' && $varValue !== null)
1257+
) {
12551258
try {
12561259
$objDate = new Date($varValue, $this->getNumericDateFormat($rgxp));
12571260
} catch (\Exception $e) {

0 commit comments

Comments
 (0)