Merge branch 'hotfix/2022-02-14' into release/2022-02-18
This commit is contained in:
@@ -23,20 +23,21 @@ export function FormDatePicker({
|
||||
onChange,
|
||||
onBlur,
|
||||
onlyFuture,
|
||||
isDateOnly = true,
|
||||
...restProps
|
||||
}) {
|
||||
const ref = useRef();
|
||||
|
||||
const handleChange = (newDate) => {
|
||||
if (value !== newDate && onChange) {
|
||||
onChange(newDate);
|
||||
onChange(isDateOnly ? newDate && newDate.format("YYYY-MM-DD") : newDate);
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyDown = (e) => {
|
||||
if (e.key.toLowerCase() === "t") {
|
||||
if (onChange) {
|
||||
onChange(moment());
|
||||
onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment());
|
||||
// if (ref.current && ref.current.blur) ref.current.blur();
|
||||
}
|
||||
} else if (e.key.toLowerCase() === "enter") {
|
||||
@@ -64,7 +65,8 @@ export function FormDatePicker({
|
||||
});
|
||||
}
|
||||
|
||||
if (_a.isValid() && onChange) onChange(_a);
|
||||
if (_a.isValid() && onChange)
|
||||
onChange(isDateOnly ? _a.format("YYYY-MM-DD") : _a);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -19,13 +19,14 @@ const DateTimePicker = (
|
||||
return (
|
||||
<div id={id}>
|
||||
<FormDatePicker
|
||||
{...(onlyFuture && {
|
||||
disabledDate: (d) => moment().subtract(1, "day").isAfter(d),
|
||||
})}
|
||||
value={value}
|
||||
onBlur={onBlur}
|
||||
onChange={onChange}
|
||||
{...restProps}
|
||||
{...restProps}
|
||||
{...(onlyFuture && {
|
||||
disabledDate: (d) => moment().subtract(1, "day").isAfter(d),
|
||||
})}
|
||||
value={value}
|
||||
onBlur={onBlur}
|
||||
onChange={onChange}
|
||||
isDateOnly={false}
|
||||
/>
|
||||
|
||||
<TimePicker
|
||||
|
||||
Reference in New Issue
Block a user