@@ -188,7 +188,7 @@ const EulaFormComponent = ({ form, handleChange, onFinish, t }) => (
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<FormDatePicker onChange={handleChange} onlyFuture
|
<FormDatePicker onChange={handleChange} onlyToday
|
||||||
aria-label={t('eula.labels.date_accepted')} />
|
aria-label={t('eula.labels.date_accepted')} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -16,7 +16,16 @@ export default connect(mapStateToProps, mapDispatchToProps)(FormDatePicker);
|
|||||||
|
|
||||||
const dateFormat = "MM/DD/YYYY";
|
const dateFormat = "MM/DD/YYYY";
|
||||||
|
|
||||||
export function FormDatePicker({bodyshop, value, onChange, onBlur, onlyFuture, isDateOnly = true, ...restProps }) {
|
export function FormDatePicker({
|
||||||
|
bodyshop,
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
onBlur,
|
||||||
|
onlyFuture,
|
||||||
|
onlyToday,
|
||||||
|
isDateOnly = true,
|
||||||
|
...restProps
|
||||||
|
}) {
|
||||||
const ref = useRef();
|
const ref = useRef();
|
||||||
|
|
||||||
const handleChange = (newDate) => {
|
const handleChange = (newDate) => {
|
||||||
@@ -87,9 +96,13 @@ export function FormDatePicker({bodyshop, value, onChange, onBlur, onlyFuture, i
|
|||||||
onBlur={onBlur || handleBlur}
|
onBlur={onBlur || handleBlur}
|
||||||
showToday={false}
|
showToday={false}
|
||||||
disabledTime
|
disabledTime
|
||||||
{...(onlyFuture && {
|
disabledDate={(d) => {
|
||||||
disabledDate: (d) => dayjs().subtract(1, "day").isAfter(d),
|
if (onlyToday) {
|
||||||
})}
|
return !dayjs().isSame(d, 'day');
|
||||||
|
} else if (onlyFuture) {
|
||||||
|
return dayjs().subtract(1, "day").isAfter(d);
|
||||||
|
}
|
||||||
|
}}
|
||||||
{...restProps}
|
{...restProps}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user