summaryrefslogtreecommitdiff
path: root/includes/sys_page.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/sys_page.php')
-rw-r--r--includes/sys_page.php12
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);
}