Potential resolution to date time issues post 4pm.
This commit is contained in:
@@ -23,20 +23,21 @@ export function FormDatePicker({
|
|||||||
onChange,
|
onChange,
|
||||||
onBlur,
|
onBlur,
|
||||||
onlyFuture,
|
onlyFuture,
|
||||||
|
isDateOnly = true,
|
||||||
...restProps
|
...restProps
|
||||||
}) {
|
}) {
|
||||||
const ref = useRef();
|
const ref = useRef();
|
||||||
|
|
||||||
const handleChange = (newDate) => {
|
const handleChange = (newDate) => {
|
||||||
if (value !== newDate && onChange) {
|
if (value !== newDate && onChange) {
|
||||||
onChange(newDate);
|
onChange(isDateOnly ? newDate && newDate.format("YYYY-MM-DD") : newDate);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleKeyDown = (e) => {
|
const handleKeyDown = (e) => {
|
||||||
if (e.key.toLowerCase() === "t") {
|
if (e.key.toLowerCase() === "t") {
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
onChange(moment());
|
onChange(isDateOnly ? moment().format("YYYY-MM-DD") : moment());
|
||||||
// if (ref.current && ref.current.blur) ref.current.blur();
|
// if (ref.current && ref.current.blur) ref.current.blur();
|
||||||
}
|
}
|
||||||
} else if (e.key.toLowerCase() === "enter") {
|
} 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 (
|
return (
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const DateTimePicker = (
|
|||||||
value={value}
|
value={value}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
isDateOnly={false}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TimePicker
|
<TimePicker
|
||||||
|
|||||||
Reference in New Issue
Block a user