[-] CORE: Fix regex for isDate and isDateFormat (0000-00-00 00:00:00 is now allowed)
This commit is contained in:
@@ -428,7 +428,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isDateFormat($date)
|
||||
{
|
||||
return (bool)preg_match('/^([0-9]{4})-((0?[0-9])|(1[0-2]))-((0?[1-9])|([0-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date);
|
||||
return (bool)preg_match('/^([0-9]{4})-((0?[0-9])|(1[0-2]))-((0?[0-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -439,7 +439,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isDate($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, $matches))
|
||||
if (!preg_match('/^([0-9]{4})-((0?[0-9])|(1[0-2]))-((0?[0-9])|([1-2][0-9])|(3[01]))( [0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $date, $matches))
|
||||
return false;
|
||||
return checkdate((int)$matches[2], (int)$matches[5], (int)$matches[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user