Fix #3908: DateHelper::parseDateTime() returns invalid date if given value is not parsable

This commit is contained in:
buddh4 2020-03-10 17:11:25 +01:00
parent 6a2a36da30
commit 500ac8c3c2
2 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,10 @@
HumHub Change Log
=================
1.4.4 (Unreleased)
---------------------
- Fix #3908: `DateHelper::parseDateTime()` returns invalid date if given value is not parsable
1.4.3 (March 4, 2020)
---------------------
- Fix #3887: CSS presentation issue for tables wider than the container and videos missing borders (areasas)

View File

@ -89,12 +89,17 @@ class DateHelper
* @param string $value date value
* @param string $pattern pattern
* @param string $timeValue optional time value
* @return int timestamp in utc
* @return int|false timestamp in utc or false in case value was could not be parsed
* @throws \Exception
*/
public static function parseDateTime($value, $pattern = 'Y-m-d', $timeValue = null)
{
$ts = self::parseDateTimeToTimestamp($value, $timeValue);
if($ts === false) {
return false;
}
$dt = new \DateTime();
$dt->setTimestamp($ts);