Skip to content

Commit

Permalink
Feat/recovery duration (#90)
Browse files Browse the repository at this point in the history
* revised min and max for valid from and valid to

* changed max and min date
  • Loading branch information
fOppenheimer authored Jun 3, 2021
1 parent 57d5642 commit b543bc4
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/record-recovery-cert-data.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const RecordRecoveryCertData = (props: any) => {
const [dateValidFrom, setDateValidFrom] = React.useState<Date>();
const [dateValidTo, setDateValidTo] = React.useState<Date>();


React.useEffect(() => {
if (!props.eudgc || !props.eudgc.r || !props.eudgc.r[0]) {
return;
Expand Down Expand Up @@ -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
/>
<span className='space-five'>{'-'}</span>
Expand All @@ -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
/>
</Col>
Expand Down

0 comments on commit b543bc4

Please sign in to comment.