LP1889128 <eg-date-select/> clearable via model
authorBill Erickson <berickxx@gmail.com>
Tue, 3 Nov 2020 20:03:23 +0000 (15:03 -0500)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 6 Jan 2021 00:48:27 +0000 (16:48 -0800)
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>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>

Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts

index d855f6d..b66a261 100644 (file)
@@ -130,6 +130,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;
         }
     }