[-] Core: Fix date validator #PSCFV-5797
This commit is contained in:
@@ -487,9 +487,9 @@ class ValidateCore
|
||||
{
|
||||
if (empty($date) || $date == '0000-00-00')
|
||||
return true;
|
||||
if (preg_match('/^([0-9]{4})-((0?[1-9])|(1[0-2]))-((0?[1-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date, $birth_date))
|
||||
if (preg_match('/^([0-9]{4})-((?:0?[1-9])|(?:1[0-2]))-((?:0?[1-9])|(?:[1-2][0-9])|(?:3[01]))([0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date, $birth_date))
|
||||
{
|
||||
if ($birth_date[1] > date('Y') || $birth_date[2] > date('m') || $birth_date[3] > date('d'))
|
||||
if ($birth_date[1] > date('Y') && $birth_date[2] > date('m') && $birth_date[3] > date('d'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user