When the locale of the DatePickerInput component is set to "de" (German), the functionality to add an automatic date separator ("." in the case of the German locale) is broken. Instead of appending a dot to the first two characters entered, the input gets changed to a single dot. Subsequently, any numbers entered are concatenated without the proper separator.
Example: After typing the digits "25" into the input field, the input field replaces the value to "." instead of "25."
Expected behaviour
When setting the locale to "de", the DatePickerInput component should correctly append a dot (".") to the first two characters entered and add subsequent characters after the dot, maintaining the proper date format.
How to reproduce?
Set the locale of the DatePickerInput component to "de".
Click on the input field to activate the date picker.
Type in the first two characters of a date, for example, "15".
Observe that the input is changed to ".", resulting in a single dot character.
Continue entering numbers, such as "02".
Notice that the input concatenates the numbers without the automatic date separator, resulting in ".02" instead of "15.02.".
@pragatheeswarans Thanks for opening this issue. If this issue is critical for you, please consider sending a pull request to fix it. If not, we will do our best to get it resolved when available.
Current behaviour
When the locale of the DatePickerInput component is set to "de" (German), the functionality to add an automatic date separator ("." in the case of the German locale) is broken. Instead of appending a dot to the first two characters entered, the input gets changed to a single dot. Subsequently, any numbers entered are concatenated without the proper separator.
Example: After typing the digits "25" into the input field, the input field replaces the value to "." instead of "25."
Expected behaviour
When setting the locale to "de", the DatePickerInput component should correctly append a dot (".") to the first two characters entered and add subsequent characters after the dot, maintaining the proper date format.
How to reproduce?
Expo Snack: https://snack.expo.dev/@pragatheeswaransornarajan/react-native-paper-dates-input
Preview
https://github.com/web-ridge/react-native-paper-dates/assets/19588386/fcc40e70-8fbc-4869-a960-54550cba34ae
What have you tried so far?
Managed to find the lines that might have caused this issue. It is from this PR and the lines here.
In
en
locale, the value ofreplace
is$1/$2/$3$4
whereas inde
locale, the value ofreplace
is..........
The issue is reproducible in the latest version
0.18.1
Your Environment