mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Datumsprüfung bei Geburtsdatum korrigiert
This commit is contained in:
@@ -377,11 +377,12 @@ if(!$error)
|
||||
$error = true;
|
||||
}
|
||||
$datum = new datum();
|
||||
$geb = $_POST['geburtsdatum'];
|
||||
if(!$datum->verifyDate($geb))
|
||||
|
||||
$gebdatum = $_POST['geburtsdatum'];
|
||||
if($gebdatum!='' && !$datum->checkDatum($gebdatum))
|
||||
{
|
||||
$return = false;
|
||||
$errormsg = 'Datum ist nicht korrekt: '.$geb;
|
||||
$errormsg = 'Geburtsdatum ist nicht korrekt.';
|
||||
$error = true;
|
||||
}
|
||||
if(!$error)
|
||||
|
||||
@@ -415,22 +415,5 @@ class datum
|
||||
{
|
||||
return intval(substr($timestring, 0, 2)) + intval(substr($timestring, 3, 2)) / 60;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft das Datum
|
||||
* @param $date = string
|
||||
* @return true wenn ok, sonst false
|
||||
*/
|
||||
static public function verifyDate($date, $strict = true)
|
||||
{
|
||||
$dateTime = DateTime::createFromFormat('Y-m-d', $date);
|
||||
if ($strict) {
|
||||
$errors = DateTime::getLastErrors();
|
||||
if (!empty($errors['warning_count'])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $dateTime !== false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user