-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
date-picker's format
prop not localized when using date-fns localized date string (e.g. PP
)
#250
Comments
It seems to be the problem of date-fns. Please see https://codesandbox.io/s/sleepy-ardinghelli-320ju?file=/src/index.js |
https://codesandbox.io/s/confident-johnson-w6ky5?file=/src/index.js:35-72 with my locale (italian, it seems to work for spanish ( |
I'm not really that familiar with date-fns but as far as I can see you need to provide a locale option for every function call (e.g. |
Yes, I use it because it's treeshakable. However I just expose a number interface outside, if you want use other libs it's not hard. |
If you need more locale please create a PR and add the locale you needed. |
I created an italian locale for my project. I'll submit a pr once I'm sure it's all good 👍🏿 |
would you consider adding the locale parameter to format's date-fns function. Here for example: https://github.com/TuSimple/naive-ui/blob/main/src/date-picker/src/DatePicker.tsx#L336 |
Sure, it seems to be a bug. |
Some |
TuSimple/naive-ui version (版本)
2.13.0
Vue version (Vue 版本)
3.1.2
Browser and its version (浏览器及其版本)
Chrome 91.0.4472.106
System and its version (系统及其版本)
Windows 10
Node version (Node 版本)
Reappearance link (重现链接)
https://codesandbox.io/s/affectionate-browser-e13mu?file=/src/Demo.vue
Reappearance steps (重现步骤)
Select the chinese locale
Select a date
Observe the formatted value in the date-picker field
Expected results (期望的结果)
The format of the date matches the locale
Actual results (实际的结果)
The format of the date is always in the english locale
Remarks (补充说明)
The text was updated successfully, but these errors were encountered: