Fix format date to mysql on date stream filter (#5825)

* Fix format date to mysql on date stream filter

* Update CHANGELOG.md (#5825)
This commit is contained in:
Yuriy Bakhtin 2022-08-03 18:45:24 +03:00 committed by GitHub
parent e33a9fad16
commit a1af6f64f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,7 @@ HumHub Changelog
1.12.1 (Unreleased)
----------------------
- Fix #5822: Fix content width in mobile view
- Fix #5825: Fix format date to mysql on date stream filter
1.12.0 (July 27, 2022)
----------------------

View File

@ -70,9 +70,10 @@ class DateStreamFilter extends StreamQueryFilter
{
$localeDateFormat = FormatConverter::convertDateIcuToPhp(Yii::$app->formatter->dateInputFormat);
$timeZone = new DateTimeZone(Yii::$app->formatter->timeZone);
$dateTime = DateTime::createFromFormat($localeDateFormat, $date, $timeZone);
$mysqlDateFormat = 'Y-m-d';
return DateTime::createFromFormat($localeDateFormat, $date, $timeZone)
->format('Y-m-d');
return $dateTime ? $dateTime->format($mysqlDateFormat) : date($mysqlDateFormat);
}
private function isFilteredFrom(): bool