LP1889128 <eg-date-select/> clearable via model
authorBill Erickson <berickxx@gmail.com>
Tue, 3 Nov 2020 20:03:23 +0000 (15:03 -0500)
committerBill Erickson <berickxx@gmail.com>
Tue, 3 Nov 2020 20:03:25 +0000 (15:03 -0500)
Allow users of <eg-date-select /> to clear the selected value (set
current = null) via updates to their ngModel variable.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts

index 66d363a..ba41a78 100644 (file)
@@ -129,6 +129,9 @@ export class DateSelectComponent implements OnInit, ControlValueAccessor {
                 month: value.getMonth() + 1,
                 day: value.getDate()
             };
+        } else {
+            // Allow the value to be cleared via model change.
+            this.current = null;
         }
     }