-
-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
Fix DatePicker not using custom dateFormat from locale #42485
Fix DatePicker not using custom dateFormat from locale #42485
Conversation
|
Great contribution, for which I am grateful. It seems that this solution is not correct, we should fix it in rc-pciker ( the |
@@ -137,6 +145,7 @@ export default function generatePicker<DateType>(generateConfig: GenerateConfig< | |||
superNextIcon={<span className={`${prefixCls}-super-next-icon`} />} | |||
allowClear | |||
transitionName={`${rootPrefixCls}-slide-up`} | |||
format={locale!.dateFormat} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dateFormat
needs to be implemented in rc-picker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I see, I misunderstand the discussion, let me see if I can fix it in the rc-picker side and then bump it here! Do you happen to know the commit in which the issue occurred in the rc-picker?
Would it be better to close this pull request or save it for bump/upgrade?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be a refactoring that left this logic. I'll take time to find the relevant pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@any1024 Oh, that will help me, I tried to troubleshoot it by myself and did not got any success, I tried to look the changes, I also tested another rc-picker
versions, such: 3.1.0, 3.2.x... also with no success
You need to support the locale format in |
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
This issue is that the locale and context locale was not being considered in the code, so I added the code to merge locales and use it in the date format by the
format
prop. the order of priority in the locale is:componentProp
>localeProp
>localeContext
I will write some tests/demo for this if this is the right behavior!
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
🤖 Generated by Copilot at 9183c64
Added global configuration for date format in
Locale
and used it inDatePicker
. This enables consistent and customizable formatting of dates across components and locales.🔍 Walkthrough
🤖 Generated by Copilot at 9183c64
dateFormat
property toLocale
interface to allow custom date format for components (link)ConfigContext
to get global locale and date format forDatePicker
component (link, link)format
prop toPicker
component to display date according to locale and date format (link)