LP1889128 <eg-date-select/> clearable via model
authorBill Erickson <berickxx@gmail.com>
Tue, 3 Nov 2020 20:03:23 +0000 (15:03 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 7 Dec 2020 14:44:01 +0000 (09:44 -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>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
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;
         }
     }