IO-1708 Updated timezone for date fields.
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user