mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.15k stars 1.3k forks source link

[pickers] Support jalali / jalaali adapters with persian digits #8985

Open alisaboori-araz opened 1 year ago

alisaboori-araz commented 1 year ago

Duplicates

Latest version

Steps to reproduce πŸ•Ή

Link to live example: https://codesandbox.io/s/quizzical-benz-mltsgg?file=/demo.js Steps: change moment.local to "fa" set DateTimePicker formatter to "jYY"

Current behavior 😯

get the following error :

MUI: The token jYY should have a 'maxDigitNumber' property on it's adapter

also by setting the DateTimePicker formatter to "jYYYY" it will return the value of "0NaN"

Expected behavior πŸ€”

Should work with any moment.local that we could possibly set.

Context πŸ”¦

No response

Your environment 🌎

System: OS: Windows 10 10.0.22000 Binaries: Node: 18.12.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD npm: 8.13.2 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: Not Found Edge: Spartan (44.22000.120.0), Chromium (113.0.1774.35) npmPackages: @emotion/react: latest => 11.11.0 @emotion/styled: latest => 11.11.0 @mui/base: 5.0.0-beta.0 @mui/core-downloads-tracker: 5.13.0 @mui/material: latest => 5.13.0 @mui/private-theming: 5.12.3 @mui/styled-engine: 5.12.3 @mui/system: latest => 5.12.3 @mui/types: 7.2.4 @mui/utils: 5.12.3 @mui/x-date-pickers: 6.4.0 => 6.4.0 @types/react: 17.0.59 react: latest => 18.2.0 react-dom: latest => 18.2.0 typescript: 5.0.4

Order ID or Support key πŸ’³ (optional)

No response

flaviendelangle commented 1 year ago

Hi,

It seems that we don't support correctly the digit sections with persian numbers Is there something preventing you from replacing your locale management by

jMoment.loadPersian({ usePersianDigits: false });

If you do need to persian numbers, I can rename this issue to make sure we are working towards a correct support :+1:

alisaboori-araz commented 1 year ago

Thank you for your attention to this matter. Unfortunately, we need to set the usePersianDigits parameter to true in order to properly display Persian numerical characters.