web-ridge / react-native-paper-dates

Smooth and fast cross platform Material Design date and time picker for React Native Paper
https://www.reactnativepaperdates.com
MIT License
662 stars 170 forks source link

translate date format #249

Closed mikib0 closed 1 year ago

mikib0 commented 1 year ago

Closes #232

Before: before

After: after

mikib0 commented 1 year ago

@iM-GeeKy supported translations and maybe this part of the docs may need to be updated right?

iM-GeeKy commented 1 year ago

@iM-GeeKy supported translations and maybe this part of the docs may need to be updated right?

Yeah, that seems like an appropriate spot for it.

mikib0 commented 1 year ago

The date format length in some locales like ko and ar may not equal the date input text length. For example a date input like 02/01/2023 has equal length with the date format MM/DD/YYYY in the en locale, but it doesn't with the ar date format يوم/شهر/سنة (length = 11). This raises a problem with this condition check text.length == mask.length in TextInputWithMask component, as the mask length (11 in the case of ar) doesn't equal the date input text length (8). What should we do now? @iM-GeeKy

iM-GeeKy commented 1 year ago

The date format length in some locales like ko and ar may not equal the date input text length. For example a date input like 02/01/2023 has equal length with the date format MM/DD/YYYY in the en locale, but it doesn't with the ar date format يوم/شهر/سنة (length = 11). This raises a problem with this condition check text.length == mask.length in TextInputWithMask component, as the mask length (11 in the case of ar) doesn't equal the date input text length (8). What should we do now? @iM-GeeKy

Ahh, I think I see what you're talking about. The only thing I can think of off the top of my head is potentially having some sort of getter function to retrieve the right mask length via a switch/case or something of the like. It's not the most elegant solution though, perhaps @RichardLindhout has an idea?

RichardLindhout commented 1 year ago

Looks good to me! Maybe we should indeed do some kind of function or put some things outside of the component so we can get the maskLength everywhere. I'm not sure or have the time too check this out deep but update is welcome, and then we can merge!

SoyDiego commented 1 year ago

Hi @mikib0, will you continue with this PR or maybe can I help in something to continue it?

Thanks!

iM-GeeKy commented 1 year ago

I'm going to close due to lack of movement. If it is still applicable, please update and we can readdress it.