react-native-datepicker
react-native-datepicker copied to clipboard
Date string ignores the locale
Issue
When I set the locale of the date picker to "fr", I see that the options within the UIDatePicker have changed to French. However, the date string for that date is still in English. I'm using the "LL" and "LT" format strings.
Expected Behavior
The date string should have the French locale when I specify "fr" as the locale.
Code
Environment
react-native -v:node -v:npm -v:yarn --version:target platform: Android | iOSoperating system:
can we have some disclosure here? I noticed in your code you only use the prop locale for the DatePickerIOS, can't it be added to android?
I never tried it on Android
Same issue here
Was this ever solved?
Same issue
Same issue
This actually can be overcome by using "getDateStr" instead of using "date". getDateStr takes Date as an input, you can use that input with your favorite library (eg momentjs) to convert the time to desired format and locale(language).
The only way language works for me is like this:
import moment from "moment"; if (getPrimaryLanguage() === "zh") {require("moment/locale/zh-cn")};
Define getPrimaryLanguage() yourself use library like i18njs...