HosseinShabani / react-native-modern-datepicker

A customizable calendar, time & month picker for React Native (including Persian Jalaali calendar & locale)
MIT License
578 stars 164 forks source link

Locale capability? #40

Open DanielGrozdev opened 3 years ago

DanielGrozdev commented 3 years ago

Hello. Is there any capability to show translated months for example may be pass a list of month names or a locale string is it possible? Thank you.

rokam commented 3 years ago

By reading the code, I think you're able to user the configs prop to pass the momentjs parameters in the format:

{
  dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  dayNamesShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
  monthNames: [
    'January',
    'February',
    'March',
    'April',
    'May',
    'June',
    'July',
    'August',
    'September',
    'October',
    'November',
    'December',
  ],
  selectedFormat: 'YYYY/MM/DD',
  dateFormat: 'YYYY/MM/DD',
  monthYearFormat: 'YYYY MM',
  timeFormat: 'HH:mm',
  hour: 'Hour',
  minute: 'Minute',
  timeSelect: 'Select',
  timeClose: 'Close',
}
Chill-Studio commented 3 years ago

Indeed it work passing the props configs

configs={{
        dayNames: [
          "Dimanche",
          "Lundi",
          "Mardi",
          "Mercredi",
          "Jeudi",
          "Vendredi",
          "Samedi",
        ],
        dayNamesShort: ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"],
        monthNames: [
          "Janvier",
          "Fevrier",
          "Mars",
          "Avri",
          "Mai",
          "Juin",
          "Juillet",
          "Août",
          "Septembre",
          "Octobre",
          "Novembre",
          "Decembre",
        ],
      }}

Gives

Screenshot 2021-05-13 at 17 55 53

This can be close.