From 7b5c9b7b22c9b545fadd5944f32684d0b0f1be95 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Wed, 22 Jun 2022 17:43:58 +0300 Subject: [PATCH] Display placeholder for date filter (#5767) * Display placeholder for date filter * CHANGELOG Update (#5767) Co-authored-by: Lucas Bartholemy --- CHANGELOG_DEV.md | 2 ++ .../modules/ui/filter/widgets/DatePickerFilterInput.php | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG_DEV.md b/CHANGELOG_DEV.md index 4852c74c8a..51c4d0b356 100644 --- a/CHANGELOG_DEV.md +++ b/CHANGELOG_DEV.md @@ -13,5 +13,7 @@ - Enh #5598: Added `cy` Welsh language - Fix #5338: Content topic/visibility changes are re-indexed in search index - Enh #5535: Invisible users +- Enh #5747: Switch Mailer Library to `Symfony Mailer` +- Enh #5767: Display placeholder for date filter - Enh #5747: Switch Mailer Library to `Symfony Mailer` - Fix #5765: Fix rendering content form on external modules diff --git a/protected/humhub/modules/ui/filter/widgets/DatePickerFilterInput.php b/protected/humhub/modules/ui/filter/widgets/DatePickerFilterInput.php index d521484ac8..fc9c8d99ba 100644 --- a/protected/humhub/modules/ui/filter/widgets/DatePickerFilterInput.php +++ b/protected/humhub/modules/ui/filter/widgets/DatePickerFilterInput.php @@ -8,9 +8,10 @@ namespace humhub\modules\ui\filter\widgets; +use DateTime; use humhub\modules\ui\form\widgets\DatePicker; use Yii; -use yii\helpers\ArrayHelper; +use yii\helpers\FormatConverter; class DatePickerFilterInput extends FilterInput { @@ -36,6 +37,11 @@ class DatePickerFilterInput extends FilterInput { $filter = Yii::$app->request->get($this->category); $this->value = $filter; + + if (!isset($this->options['placeholder'])) { + $this->options['placeholder'] = (new DateTime()) + ->format(FormatConverter::convertDateIcuToPhp(Yii::$app->formatter->dateInputFormat)); + } } /**