'Material UI Datepicker all dates are displaced by a day
I'm utilizing the Material UI Datepicker from Labs in a Design System I created using Storybook.
interface MuiDatePickerProps {
date: Datable;
disableFuture?: boolean;
locale?: string;
onChange: (e: Datable) => void;
}
export const MuiDatePicker = ({
date,
disableFuture,
error,
locale,
onChange,
}: MuiDatePickerProps) => {
return (
<div css={css(muiDatePickerStyle)}>
<LocalizationProvider dateAdapter={AdapterMoment} {...{ locale }}>
<CalendarPicker {...{ date, disableFuture, onChange }} />
</LocalizationProvider>
</div>
);
};
I've come across a problem where all dates after 1. March 2022 are displaced by a day. So 1. March 2022 is actually on a Tuesday, but the datepicker has displaced everything so 1. March 2022 is on a Monday. All dates/days following this date are then displayed wrong. The weird thing is that when looking at the component through Storybook, then the dates are displayed correctly, but when importing the component into my project, then the displacement happens.
I've looked through the documentation and done some searching. I have yet to find someone that has had the same problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

