Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pickers] Add AdapterDateFnsJalaliV3 adapter #12891

Merged
merged 17 commits into from May 8, 2024

Conversation

smmoosavi
Copy link
Contributor

@smmoosavi smmoosavi commented Apr 24, 2024

AdapterDateFnsJalaliV3

I am trying to add AdapterDateFnsJalaliV3 to x-date-pickers

babel config problem. solved but I have a problem with the Babel config to replace `date-fns-jalali` with `date-fns-jalali-v3`. can anyone help to fix the problem?
// in AdapterDateFnsJalaliV3.ts
console.log(module.children.map(f => f.filename))
[
  '/.../mui-x/node_modules/date-fns-jalali/addSeconds/index.js',
  '/.../mui-x/node_modules/date-fns-jalali/addMinutes/index.js',
  '/.../mui-x/node_modules/date-fns-jalali/addHours/index.js',
  '/.../mui-x/node_modules/date-fns-jalali/addDays/index.js',
  // ...
]

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 24, 2024
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@zannager zannager added the component: pickers This is the name of the generic UI component, not the React module! label Apr 24, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label May 7, 2024
@smmoosavi smmoosavi changed the title WIP: add AdapterDateFnsJalaliV3 add AdapterDateFnsJalaliV3 May 7, 2024
@smmoosavi
Copy link
Contributor Author

I found the problem with the Babel config. the patches/babel-plugin-replace-imports@1.0.2.patch patch had hard-coded AdapterDateFnsV3.ts

- _ref2.filename.includes('AdapterDateFnsV3.ts')
+ _ref2.filename.includes(_ref2.opts.filenameIncludes || '')

@smmoosavi
Copy link
Contributor Author

I hope this pull request is ready for review. I tried to have well-separated commits, especially separated copy and rename commits will help in the review process

@LukasTy

@mui-bot
Copy link

mui-bot commented May 8, 2024

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Massive thank you for your contribution @smmoosavi! 🙏

I took the liberty to update the code and add a documentation enhancement to show the usage of the v3 adapter. 😉

P.S. This adapter will be released with the next v7 release.
If there are enough requests, we can back-port it to v6. 😉
Does that make sense? 🤔

@LukasTy LukasTy added the enhancement This is not a bug, nor a new feature label May 8, 2024
@LukasTy LukasTy changed the title add AdapterDateFnsJalaliV3 [pickers] Add AdapterDateFnsJalaliV3 adapter May 8, 2024
@smmoosavi
Copy link
Contributor Author

Thanks.

P.S. This adapter will be released with the next v7 release.
If there are enough requests, we can back-port it to v6. 😉
Does that make sense? 🤔

yes.

@@ -58,7 +58,7 @@
"core-js": "^2.6.12",
"cross-env": "^7.0.3",
"date-fns": "^2.30.0",
"date-fns-jalali": "^2.21.3-1",
"date-fns-jalali": "^2.30.0-0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strangely, it has not been picked up by renovate...
The version format could be to blame. 🙈

@@ -195,7 +196,6 @@
"packageManager": "pnpm@8.15.8",
"pnpm": {
"patchedDependencies": {
"date-fns-jalali@2.13.0-0": "patches/date-fns-jalali@2.13.0-0.patch",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not seem needed anymore! 👏 🥳

@@ -103,7 +103,7 @@
"@types/moment-jalaali": "^0.7.9",
"@types/prop-types": "^15.7.12",
"date-fns": "^2.30.0",
"date-fns-jalali": "^2.13.0-0",
"date-fns-jalali": "^2.30.0-0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to bump the version to have the exported date-fns-jalali/locale/types file so the build would pass.

@LukasTy LukasTy merged commit 2a5b8fe into mui:master May 8, 2024
17 checks passed
@smmoosavi smmoosavi deleted the date-fns-jalali-v3 branch May 8, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants