From ce4fb613ac4832b0d337d0d99fe3dc6084590b9d Mon Sep 17 00:00:00 2001 From: Thetsmr Date: Thu, 24 Oct 2024 13:27:01 +0200 Subject: [PATCH] Fix mindate & maxdate for showDateTimeField --- .phpstan-baseline.php | 24 ------------------------ src/Html.php | 8 ++++---- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/.phpstan-baseline.php b/.phpstan-baseline.php index caf7d6149c8..c25c4dd8427 100644 --- a/.phpstan-baseline.php +++ b/.phpstan-baseline.php @@ -2251,30 +2251,6 @@ 'count' => 2, 'path' => __DIR__ . '/src/Html.php', ]; -$ignoreErrors[] = [ - // identifier: offsetAccess.notFound - 'message' => '#^Offset \'max\' does not exist on array\\{value\\: mixed, maybeempty\\: mixed, canedit\\: mixed, mindate\\: mixed, maxdate\\: mixed, mintime\\: mixed, maxtime\\: mixed, timestep\\: mixed, \\.\\.\\.\\}\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/src/Html.php', -]; -$ignoreErrors[] = [ - // identifier: empty.offset - 'message' => '#^Offset \'max\' on array\\{value\\: mixed, maybeempty\\: mixed, canedit\\: mixed, mindate\\: mixed, maxdate\\: mixed, mintime\\: mixed, maxtime\\: mixed, timestep\\: mixed, \\.\\.\\.\\} in empty\\(\\) does not exist\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/src/Html.php', -]; -$ignoreErrors[] = [ - // identifier: offsetAccess.notFound - 'message' => '#^Offset \'min\' does not exist on array\\{value\\: mixed, maybeempty\\: mixed, canedit\\: mixed, mindate\\: mixed, maxdate\\: mixed, mintime\\: mixed, maxtime\\: mixed, timestep\\: mixed, \\.\\.\\.\\}\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/src/Html.php', -]; -$ignoreErrors[] = [ - // identifier: empty.offset - 'message' => '#^Offset \'min\' on array\\{value\\: mixed, maybeempty\\: mixed, canedit\\: mixed, mindate\\: mixed, maxdate\\: mixed, mintime\\: mixed, maxtime\\: mixed, timestep\\: mixed, \\.\\.\\.\\} in empty\\(\\) does not exist\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/src/Html.php', -]; $ignoreErrors[] = [ // identifier: deadCode.unreachable 'message' => '#^Unreachable statement \\- code above always terminates\\.$#', diff --git a/src/Html.php b/src/Html.php index 33a9de0fcb1..67f22ece576 100644 --- a/src/Html.php +++ b/src/Html.php @@ -3051,11 +3051,11 @@ public static function showDateTimeField($name, $options = []) $date_format = Toolbox::getDateFormat('js') . " H:i:S"; - $min_attr = !empty($p['min']) - ? "minDate: '{$p['min']}'," + $min_attr = !empty($p['mindate']) + ? "minDate: '{$p['mindate']}'," : ""; - $max_attr = !empty($p['max']) - ? "maxDate: '{$p['max']}'," + $max_attr = !empty($p['maxdate']) + ? "maxDate: '{$p['maxdate']}'," : ""; $locale = Locale::parseLocale($_SESSION['glpilanguage']);