Skip to content

Commit

Permalink
OP-1806: fix calendar picker to allow selecting future dates
Browse files Browse the repository at this point in the history
  • Loading branch information
olewandowski1 committed Feb 8, 2024
1 parent 24c4cf1 commit ca66584
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/ContractHeadPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,13 @@ class ContractHeadPanel extends FormPanel {
module="contract"
label="dateValidFrom"
required
maxDate={!!edited && !!edited.dateValidTo && edited.dateValidTo}
value={!!edited && !!edited.dateValidFrom && edited.dateValidFrom}
onChange={(v) => this.updateAttribute("dateValidFrom", v)}
readOnly={readOnlyFields.includes("dateValidFrom") || isAmendment}
// NOTE: maxDate cannot be passed if endDate does not exist.
// Passing any other falsy value will block months manipulation.
// eslint-disable-next-line react/jsx-props-no-spreading
{...(edited.dateValidTo ? { maxDate: edited.dateValidTo } : null)}
/>
</Grid>
<Grid item xs={2} className={classes.item}>
Expand All @@ -292,12 +295,13 @@ class ContractHeadPanel extends FormPanel {
module="contract"
label="dateValidTo"
required
minDate={
!!edited && !!edited.dateValidFrom && edited.dateValidFrom
}
value={!!edited && !!edited.dateValidTo && edited.dateValidTo}
onChange={(v) => this.updateAttribute("dateValidTo", v)}
readOnly={readOnlyFields.includes("dateValidTo")}
// NOTE: minDate cannot be passed if startDate does not exist.
// Passing any other falsy value will block months manipulation.
// eslint-disable-next-line react/jsx-props-no-spreading
{...(edited.dateValidFrom ? { minDate: edited.dateValidFrom } : null)}
/>
</Grid>
</Grid>
Expand Down

0 comments on commit ca66584

Please sign in to comment.