From b543bc472f9651cc28c3bba1452d3e088ebfcf4f Mon Sep 17 00:00:00 2001 From: fOppenheimer <80682747+fOppenheimer@users.noreply.github.com> Date: Thu, 3 Jun 2021 15:31:51 +0200 Subject: [PATCH] Feat/recovery duration (#90) * revised min and max for valid from and valid to * changed max and min date --- .../record-recovery-cert-data.component.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/record-recovery-cert-data.component.tsx b/src/components/record-recovery-cert-data.component.tsx index 3dd4bc6..09428f2 100644 --- a/src/components/record-recovery-cert-data.component.tsx +++ b/src/components/record-recovery-cert-data.component.tsx @@ -61,7 +61,6 @@ const RecordRecoveryCertData = (props: any) => { const [dateValidFrom, setDateValidFrom] = React.useState(); const [dateValidTo, setDateValidTo] = React.useState(); - React.useEffect(() => { if (!props.eudgc || !props.eudgc.r || !props.eudgc.r[0]) { return; @@ -264,10 +263,9 @@ const RecordRecoveryCertData = (props: any) => { showMonthDropdown showYearDropdown dropdownMode="select" - //TODO: possibly calculate dat min and max - maxDate={dateValidTo ? dateValidTo : new Date()} + maxDate={new Date()} minDate={dateValidTo ? new Date(dateValidTo.getTime() - expirationMilSeconds) : new Date(Date.now() - expirationMilSeconds)} - openToDate={new Date()} + openToDate={dateValidFrom ? dateValidFrom : new Date()} required /> {'-'} @@ -282,10 +280,9 @@ const RecordRecoveryCertData = (props: any) => { showMonthDropdown showYearDropdown dropdownMode="select" - //TODO: calculate date min and max maxDate={dateValidFrom ? new Date(dateValidFrom.getTime() + expirationMilSeconds) : new Date(Date.now() + expirationMilSeconds)} - minDate={dateValidFrom ? dateValidFrom : new Date()} - openToDate={new Date()} + minDate={new Date()} + openToDate={dateValidTo ? dateValidTo : new Date()} required />