Skip to content

Commit

Permalink
[docs] Add warning for luxon macro tokens (mui#8245)
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle authored Mar 16, 2023
1 parent df9d06c commit 27bf4bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/data/date-pickers/adapters-locale/adapters-locale.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';

{{"demo": "LocalizationLuxon.js"}}

:::warning
The Date and Time Pickers are not working well with Luxon macro-token (`D`, `DD`, `T`, `TT`, ...),
because of [how they are expanded](https://github.com/mui/mui-x/issues/7615).

If your application is using only a single locale, the easiest solution is to manually provide a format that does not contain any macro-token
(e.g. `M/d/yyyy` instead of `D` for the english locale).

As soon as a solution is found the built-in support will be improved.
:::

### With `moment`

For `moment`, import the locale and then pass its name to `LocalizationProvider`:
Expand Down
10 changes: 10 additions & 0 deletions docs/data/date-pickers/overview/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ The Date and Time Pickers currently support the following date libraries:
- [Luxon](https://moment.github.io/luxon/#/)
- [Moment.js](https://momentjs.com/)

:::warning
The Date and Time Pickers are not working well with Luxon macro-token (`D`, `DD`, `T`, `TT`, ...),
because of [how they are expanded](https://github.com/mui/mui-x/issues/7615).

If your application is using only a single locale, the easiest solution is to manually [provide a format](/x/react-date-pickers/adapters-locale/#custom-formats) that does not contain any macro-token
(e.g. `M/d/yyyy` instead of `D` for the english locale).

As soon as a solution is found the built-in support will be improved.
:::

:::info
If you are using a non-Gregorian calendar (such as Jalali or Hijri), please refer to the [Support for other calendar systems](/x/react-date-pickers/calendar-systems/) page.
:::
Expand Down

0 comments on commit 27bf4bc

Please sign in to comment.