LogEventsList: Don't output '0000-00-00' as default date
authorBartosz Dziewoński <matma.rex@gmail.com>
Wed, 14 Nov 2018 14:49:22 +0000 (15:49 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Wed, 14 Nov 2018 14:49:22 +0000 (15:49 +0100)
It is an invalid value that should be (by spec) ignored by the
browser, but apparently some browsers don't ignore it, and when they
submit it back, it is converted to -0001-11-30 by our date parsing.

Bug: T209490
Change-Id: I2643767a0091c1c9db78706358903e1dc97b59d1

includes/logging/LogEventsList.php

index a5aa687..7317367 100644 (file)
@@ -148,7 +148,7 @@ class LogEventsList extends ContextSource {
                $formDescriptor['date'] = [
                        'type' => 'date',
                        'label-message' => 'date',
-                       'default' => sprintf( "%04d-%02d-%02d", $year, $month, $day ),
+                       'default' => $year && $month && $day ? sprintf( "%04d-%02d-%02d", $year, $month, $day ) : '',
                ];
 
                // Tag filter