diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-09-25 17:33:31 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-10-30 21:13:56 +0100 |
commit | 7f61dc95be4ac543986c7df2459532fd8f81368d (patch) | |
tree | 930497c659bbaa3e073313a261f3458348fd423d /includes/sys_page.php | |
parent | 63d1292bf80d88be40eec7695c1a59f29e6609c5 (diff) |
EventConfig: Merge event configuration from database to global config
Diffstat (limited to 'includes/sys_page.php')
-rw-r--r-- | includes/sys_page.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/includes/sys_page.php b/includes/sys_page.php index 55fb3b38..a560c3ba 100644 --- a/includes/sys_page.php +++ b/includes/sys_page.php @@ -1,5 +1,6 @@ <?php +use Carbon\Carbon; use Engelsystem\ValidationResult; /** @@ -134,9 +135,16 @@ function check_request_date($name, $error_message = null, $null_allowed = false) */ function check_date($input, $error_message = null, $null_allowed = false) { - if ($tmp = parse_date('Y-m-d H:i', trim($input) . ' 00:00')) { - return new ValidationResult(true, $tmp); + try { + $time = Carbon::createFromFormat('Y-m-d', trim($input)); + } catch (InvalidArgumentException $e) { + $time = null; } + + if ($time) { + return new ValidationResult(true, $time); + } + if ($null_allowed) { return new ValidationResult(true, null); } |