Fix empty time filter selections
authorMarcel Werk <burntime@woltlab.com>
Tue, 19 Nov 2024 13:32:22 +0000 (14:32 +0100)
committerMarcel Werk <burntime@woltlab.com>
Tue, 19 Nov 2024 13:32:22 +0000 (14:32 +0100)
wcfsetup/install/files/lib/system/form/builder/field/DateRangeFormField.class.php
wcfsetup/install/files/lib/system/gridView/filter/TimeFilter.class.php

index 96d8a26666cd038ac9f3c973b759dee39c91dca7..accb3f29ef186e12b715eab415ef2473dcd1fb79 100644 (file)
@@ -50,7 +50,7 @@ class DateRangeFormField extends AbstractFormField implements
      */
     public function getSaveValue()
     {
-        if ($this->getValue() === null && $this->isNullable()) {
+        if (!$this->getFromValue() && !$this->getToValue() && $this->isNullable()) {
             return null;
         }
 
index 91a1889e3d3e887cd6de5d7fa4d4076fb2fdabe0..0aa876635f7514e9829fa885a6c08449c34f249c 100644 (file)
@@ -22,6 +22,7 @@ class TimeFilter implements IGridViewFilter
     {
         return DateRangeFormField::create($id)
             ->label($label)
+            ->nullable()
             ->supportTime();
     }