-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: mv DTLP into new localization/ dir
- Loading branch information
1 parent
766db61
commit 2c8160f
Showing
2 changed files
with
27 additions
and
38 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import "./setupDayjs"; | ||
import "./setupYup"; | ||
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"; | ||
import { LocalizationProvider as MuiLocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"; | ||
import type { LocalizationProviderProps } from "@mui/x-date-pickers/LocalizationProvider"; | ||
import type { Except } from "type-fest"; | ||
|
||
/** | ||
* This component provides date/time localization functionality using the Mui | ||
* `LocalizationProvider` with the `dayjs` adapter. This component is necessary | ||
* to run the Mui DatePicker/DateTimePicker components. | ||
* | ||
* > Currently, only the `"en"` locale is supported. | ||
*/ | ||
export const DateTimeLocalizationProvider = ({ | ||
children, | ||
...props | ||
}: DateTimeLocalizationProviderProps) => ( | ||
<MuiLocalizationProvider dateAdapter={AdapterDayjs} adapterLocale="en" {...props}> | ||
{children} | ||
</MuiLocalizationProvider> | ||
); | ||
|
||
export type DateTimeLocalizationProviderProps = Except< | ||
LocalizationProviderProps<unknown, "en">, | ||
"dateAdapter" | "adapterLocale" | ||
>; |