From: Bill Erickson Date: Thu, 15 Apr 2021 19:42:46 +0000 (-0400) Subject: LP1904036 date select emits on clear X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c8663e12038037d4d2a43554f4aceabfcb94a97f;p=evergreen%2Fpines.git LP1904036 date select emits on clear Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.html b/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.html index 07ce23f65c..9511091313 100644 --- a/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.html +++ b/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.html @@ -18,6 +18,7 @@ [required]="required" (blur)="propagateTouch(); onDateEnter()" [(ngModel)]="current" + (ngModelChange)="inputChanged($event)" (keyup.enter)="onDateEnter()" (dateSelect)="onDateSelect($event)"/>
diff --git a/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts b/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts index 6d9e62d6dc..5de9628050 100644 --- a/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts +++ b/Open-ILS/src/eg2/src/app/share/date-select/date-select.component.ts @@ -112,6 +112,17 @@ export class DateSelectComponent implements OnInit, ControlValueAccessor { this.propagateChange(date); } + // onDateSelect() is not called when the value is cleared. + // Handle that here. + inputChanged(value) { + if (value === null) { + this.onChangeAsDate.emit(null); + this.onChangeAsYmd.emit(null); + this.onChangeAsIso.emit(null); + this.propagateChange(null); + } + } + reset() { this.current = { year: null,