From d705eb05745ecc5febaa2a43545be1721a34d9a0 Mon Sep 17 00:00:00 2001 From: xflord <493294@mail.muni.cz> Date: Tue, 18 Apr 2023 10:20:53 +0200 Subject: [PATCH] fix(admin): fixed bug in expiration-select * fixed a bug where if no max/min date values were passed, the component returned null date (cherry picked from commit d358470b288b32d8f91c7b930cdfed914ae2880c) --- .../src/lib/expiration-select/expiration-select.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/perun/dialogs/src/lib/expiration-select/expiration-select.component.ts b/libs/perun/dialogs/src/lib/expiration-select/expiration-select.component.ts index 3307ad24f..b778c6234 100644 --- a/libs/perun/dialogs/src/lib/expiration-select/expiration-select.component.ts +++ b/libs/perun/dialogs/src/lib/expiration-select/expiration-select.component.ts @@ -25,9 +25,9 @@ export class ExpirationSelectComponent implements OnInit, OnChanges { // Change selected date to be in [min, max] range const selectedExpiration = new Date(this.expirationControl.value); let validExpiration = selectedExpiration; - if (selectedExpiration < this.minDate) { + if (this.minDate && selectedExpiration < this.minDate) { validExpiration = this.minDate; - } else if (selectedExpiration > this.maxDate) { + } else if (this.maxDate && selectedExpiration > this.maxDate) { validExpiration = this.maxDate; }