IO-1708 Updated timezone for date fields.

This commit is contained in:
Patrick Fic
2022-02-10 16:21:10 -08:00
parent e9f4b48839
commit cdd3841d49

View File

@@ -29,14 +29,16 @@ export function FormDatePicker({
const handleChange = (newDate) => {
if (value !== newDate && onChange) {
onChange(newDate);
console.log(newDate.tz(bodyshop.timezone));
onChange(newDate.tz(bodyshop.timezone));
}
};
const handleKeyDown = (e) => {
if (e.key.toLowerCase() === "t") {
if (onChange) {
onChange(moment());
console.log(moment().tz(bodyshop.timezone));
onChange(moment().tz(bodyshop.timezone));
// if (ref.current && ref.current.blur) ref.current.blur();
}
} else if (e.key.toLowerCase() === "enter") {
@@ -71,10 +73,11 @@ export function FormDatePicker({
<div onKeyDown={handleKeyDown}>
<DatePicker
ref={ref}
value={value ? moment(value) : null}
value={value ? moment(value).tz(bodyshop.timezone) : null}
onChange={handleChange}
format={dateFormat}
onBlur={onBlur || handleBlur}
showToday={false}
disabledTime
{...(onlyFuture && {
disabledDate: (d) => moment().subtract(1, "day").isAfter(d),