mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-24 17:03:27 +03:00
Renamed and updated the validation helper
This commit is contained in:
parent
584e624139
commit
658c131f79
1 changed files with 5 additions and 7 deletions
|
@ -12,17 +12,15 @@
|
|||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Check if a string date is valid for insertion or update to the database.
|
||||
* Validate a date time value.
|
||||
*
|
||||
* @param string $datetime The given date.
|
||||
* @param string $value Validation value.
|
||||
*
|
||||
* @return bool Returns the validation result.
|
||||
*
|
||||
* @link http://stackoverflow.com/a/8105844/1718162 [SOURCE]
|
||||
*/
|
||||
function validate_mysql_datetime($datetime)
|
||||
function validate_datetime(string $value): bool
|
||||
{
|
||||
$dt = DateTime::createFromFormat('Y-m-d H:i:s', $datetime);
|
||||
$date_time = DateTime::createFromFormat('Y-m-d H:i:s', $value);
|
||||
|
||||
return $dt ? TRUE : FALSE;
|
||||
return (bool)$date_time;
|
||||
}
|
Loading…
Reference in a new issue