Skip to content

Commit

Permalink
Fixed validation of empty date/time input fields (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMystikJonas authored Nov 13, 2022
1 parent db81b15 commit c7ac26b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Controls/DateTime/AbstractDateTimeInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ public function getRawValue()
*/
protected function getValueAsDateTimeImmutable()
{
if ($this->value === null || $this->value === '') {
return null;
}

$date = $this->parser->parse($this->value);
if ($date === null) {
$this->addError($this->invalidValueMessage);
Expand Down

0 comments on commit c7ac26b

Please sign in to comment.