public function isValid($value) : bool
{
$value = (string) $value;
// Form check
if (!preg_match('~^(\\d{4})-(\\d{2})-(\\d{2})$~', $value, $matches)) {
return false;
}
list(, $year, $month, $day) = $matches;
// Date validity check
if (!checkdate((int) $month, (int) $day, (int) $year)) {
return false;
}
return true;
}