react-native-datetimepicker / datetimepicker

React Native date & time picker component for iOS, Android and Windows
MIT License
2.51k stars 405 forks source link

showing Numbers, name of months, and weekdays' name according to locale #21

Closed SaeedZhiany closed 4 years ago

SaeedZhiany commented 5 years ago

Feature Request

Adding a prop that shows numbers and name of months with users prefer locale. please notice that this feature request is very related to #16, actually this an extra feature beyond the other one.

Why it is needed

this is a regular usage for Persian spoken users: they may want to work with date time picker in gregorian locale but numbers and name of months and weekdays's name showing in their language. for example, the month name January wrote as ژانویه in Farsi. (it's just the same name that Iranian pronounce it for January) similar usage exists in reverse direction. Shamsi month name can be shown with English characters. for example, we have اسفند as the last month of a year and it can be shown as Esfand.

so the various combination is like below:

  1. gregorian DateTimePicker with English numbers and English month name and weekdays' name
  2. gregorian DateTimePicker with Persian numbers and Persian converted month name (e.g. January -> ژانویه ) and weekdays' name
  3. Shamsi DateTimePicker with English numbers and English converted month name (e.g. اسفند -> Esfand) and Persian weekdays' name
  4. Shamsi DateTimePicker with Persian numbers and Persian month name and weekdays' name

Possible implementation

I don't know if it is possible to change strings android and ios native DateTime picker library. but I will update this issue I can find any.

however, there are some libraries like this that can handle the combination

Code sample

  1. <RNDateTimePicker calendarType='gregorian' locale='en' />
  2. <RNDateTimePicker calendarType='gregorian' locale='fa' />
  3. <RNDateTimePicker calendarType='shamsi' locale='en' />
  4. <RNDateTimePicker calendarType='shamsi' locale='fa' />
vonovak commented 4 years ago

hello @SaeedZhiany and thanks for the comment. Did you find any solutions to the problem? From what I understand, the locale prop can be provided to UIDatePicker and ios handles this by itself: https://developer.apple.com/documentation/uikit/uidatepicker?language=objc#2281469

if this prop is not enough for your needs, you'll need to find some 3rd party picker and bridge it to React Native. I'll close this because this module exposes UIDatePicker functionality only. Thank you.

SaeedZhiany commented 4 years ago

Hello @vonovak

Yeah, I knew it, but I look at a cross-platform solution.

unfortunately, there is no global solution for DateTime picker on Android and all the Android native third party libraries have some kind of limitations.

I suggest creating a native date picker from scratch for android. I found this library that allows us to support multiple calendars with many locales for each calendar for android, then we can bridge it fro react-native as a replacement for the current library. it would be great if you guys put your effort on the suggested solution if you have time for it. many Android native developers around the world usually prefer to use a third-party calendar due to a lack of features in the Android current calendar.

I'm a bit overloaded by the other works these days but I'll myself start to develop such a calendar for Android as soon as I find free time.

vonovak commented 4 years ago

unfortunately, there is no global solution for DateTime picker on Android and all the Android native third party libraries have some kind of limitations.

yes, I figured that people want all kinds of options supported, and picking a date turns out to be a much more difficult task than I'd imagine 😆

I suggest creating a native date picker from scratch for android.

I definitely want to avoid this in the scope of react-native-community/react-native-datetimepicker - it would put a huge maintenance burden on this module. Currently, the maintainers that started the module are not active any more, and I personally only plan to maintain it in the short term future, hoping to get more people involved.

I'm a bit overloaded by the other works these days but I'll myself start to develop such a calendar for Android as soon as I find free time.

yes, we all are :) but this is the only way forward - if this module is not good enough, start a new one and we can recommend it here for people who need more config options. Perhaps it gains traction and will eventually become popular :)

hope this makes sense, take care!

SaeedZhiany commented 4 years ago

I personally only plan to maintain it in the short term future

Are you mean this package will be deprecated in the near future?! because no other developer don't answer us among issues and pull requests.

vonovak commented 4 years ago

Are you mean this package will be deprecated in the near future?!

no, it definitely won't be deprecated, I'm just saying I'm not able to make a huge investment in it, and creating a native date picker from scratch would be a huge investment. Nothing is becoming deprecated, and as I said, I want to get more people involved in maintenance.