Skip to content

Commit

Permalink
[pickers] Support date-fns-jalali v4 (#16011)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasTy authored Dec 27, 2024
1 parent dcdc59e commit 2799763
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module.exports = function getBabelConfig(api) {
'babel-plugin-replace-imports',
{
test: /date-fns-jalali/i,
replacer: 'date-fns-jalali-v3',
replacer: 'date-fns-jalali-v4',
// This option is provided by the `patches/[email protected]` patch
filenameIncludes: 'src/AdapterDateFnsJalaliV3/',
},
Expand Down
8 changes: 4 additions & 4 deletions docs/data/date-pickers/calendar-systems/calendar-systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ The following demo shows how to use the `date-fns-jalali` adapter:
{{"demo": "AdapterJalali.js"}}

:::info
Both `date-fns-jalali` major versions (v2.x and v3.x) are supported.
We support `date-fns-jalali` package v2.x, v3.x, and v4.x major versions.

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

To use `date-fns-jalali` v3.x, you will have to import the adapter from `@mui/x-date-pickers/AdapterDateFnsJalaliV3` instead of `@mui/x-date-pickers/AdapterDateFnsJalali`.
To use `date-fns-jalali` v3.x or v4.x, you will have to import the adapter from `@mui/x-date-pickers/AdapterDateFnsJalaliV3` instead of `@mui/x-date-pickers/AdapterDateFnsJalali`.

```tsx
// with date-fns-jalali v2.x
import { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalali';
// with date-fns-jalali v3.x
// with date-fns-jalali v3.x or v4.x
import { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalaliV3';
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"cpy-cli": "^5.0.0",
"cross-env": "^7.0.3",
"danger": "^12.3.3",
"date-fns-jalali-v3": "npm:date-fns-jalali@3.6.0-1",
"date-fns-jalali-v4": "npm:date-fns-jalali@4.1.0-0",
"date-fns-v4": "npm:[email protected]",
"eslint": "^8.57.1",
"eslint-config-airbnb": "^19.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/x-date-pickers-pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@mui/material": "^5.15.14 || ^6.0.0",
"@mui/system": "^5.15.14 || ^6.0.0",
"date-fns": "^2.25.0 || ^3.2.0 || ^4.0.0",
"date-fns-jalali": "^2.13.0-0 || ^3.2.0-0",
"date-fns-jalali": "^2.13.0-0 || ^3.2.0-0 || ^4.0.0-0",
"dayjs": "^1.10.7",
"luxon": "^3.0.2",
"moment": "^2.29.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/x-date-pickers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@mui/material": "^5.15.14 || ^6.0.0",
"@mui/system": "^5.15.14 || ^6.0.0",
"date-fns": "^2.25.0 || ^3.2.0 || ^4.0.0",
"date-fns-jalali": "^2.13.0-0 || ^3.2.0-0",
"date-fns-jalali": "^2.13.0-0 || ^3.2.0-0 || ^4.0.0-0",
"dayjs": "^1.10.7",
"luxon": "^3.0.2",
"moment": "^2.29.4",
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2799763

Please sign in to comment.