Add phone limit creation to phone creation

This commit is contained in:
osaajani 2023-02-02 01:12:30 +01:00
parent fd1e7b5519
commit 298bba0c39
8 changed files with 231 additions and 21 deletions

View file

@ -165,6 +165,24 @@ namespace controllers\internals;
return $objectDate && $objectDate->format($format) === $date;
}
/**
* Check if a relative format date (see https://www.php.net/manual/en/datetime.formats.relative.php) is valid.
*
* @param string $date : Relative date
*
* @return bool : True if valid, false else
*/
public static function validate_relative_date($date)
{
try {
$d = new \DateTime($date);
} catch (\Throwable $th) {
return false;
}
return true;
}
/**
* Check if a sting represent a valid PHP period for creating an interval.
*