mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix #3908: DateHelper::parseDateTime()
returns invalid date if given value is not parsable
This commit is contained in:
parent
6a2a36da30
commit
500ac8c3c2
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user