Skip to content

Commit

Permalink
[docs] Add a note about AdapterDateFnsV3 on the Getting Started page (
Browse files Browse the repository at this point in the history
mui#11985)

Signed-off-by: Flavien DELANGLE <[email protected]>
Co-authored-by: Lukas <[email protected]>
  • Loading branch information
2 people authored and thomasmoon committed Sep 6, 2024
1 parent ce2f47d commit 3cc2571
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/data/date-pickers/adapters-locale/adapters-locale.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ For `date-fns`, import the locale and pass it to `LocalizationProvider`:
:::info
Both `date-fns` major versions (v2.x and v3.x) are supported.

A single adapter can not work for both `date-fns` v2.x and v3.x, because the way functions are exported has been changed in v3.x.
A single adapter cannot work for both `date-fns` v2.x and v3.x, because the way functions are exported has been changed in v3.x.

To use `date-fns` v3.x, you will have to import the adapter from `@mui/x-date-pickers/AdapterDateFnsV3` instead of `@mui/x-date-pickers/AdapterDateFns`.
:::
Expand Down
9 changes: 9 additions & 0 deletions docs/src/modules/components/PickersRenderingInstructions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ export default function PickersRenderingInstructions() {

const commandLines = [
`import { LocalizationProvider } from '${componentPackage}';`,
...(libraryUsed === 'date-fns'
? ['// If you are using date-fns v2.x, please import `AdapterDateFns`']
: []),
`import { ${adapterName} } from '${componentPackage}/${adapterName}'`,
...(libraryUsed === 'date-fns'
? [
'// If you are using date-fns v3.x, please import `AdapterDateFnsV3`',
`import { AdapterDateFnsV3 } from '${componentPackage}/AdapterDateFnsV3'`,
]
: []),
'',
'function App({ children }) {',
' return (',
Expand Down

0 comments on commit 3cc2571

Please sign in to comment.