diff --git a/protected/humhub/libs/DateHelper.php b/protected/humhub/libs/DateHelper.php index 0ab29d3bcd..420f5c575e 100644 --- a/protected/humhub/libs/DateHelper.php +++ b/protected/humhub/libs/DateHelper.php @@ -74,7 +74,7 @@ class DateHelper * * @param string $value * @param string $timeValue optional time value - * @return int timestamp in utc + * @return int|false timestamp in utc * @throws \Exception */ public static function parseDateTimeToTimestamp($value, $timeValue = null) diff --git a/protected/humhub/libs/DbDateValidator.php b/protected/humhub/libs/DbDateValidator.php index 66a38b6fe7..a59e7cad5a 100644 --- a/protected/humhub/libs/DbDateValidator.php +++ b/protected/humhub/libs/DbDateValidator.php @@ -99,7 +99,7 @@ class DbDateValidator extends DateValidator * Parses a date and a time value if timeAttribute is specified. * * @param string $value - * @return int timestamp in utc + * @return int|false timestamp in system timezone * @throws \Exception */ protected function parseDateTimeValue($value, $timeValue = null) @@ -111,7 +111,7 @@ class DbDateValidator extends DateValidator $timestamp = $this->parseDateValue($value); - if ($this->hasTime() && !empty($timeValue)) { + if ($timestamp !== false && $this->hasTime() && !empty($timeValue)) { $timestamp += $this->parseTimeValue($timeValue); $timestamp = $this->fixTimestampTimeZone($timestamp, $this->timeZone); } @@ -155,8 +155,10 @@ class DbDateValidator extends DateValidator /** * Parses a date and optionally a time if timeAttribute is specified. * + * Returns false in case the value could not be parsed. + * * @param string $value - * @return int timestamp in utc + * @return int|false * @throws \Exception */ public static function parseDateTime($value, $timeValue = null)