henninghall / react-native-date-picker

React Native Date Picker is datetime picker for Android and iOS. It includes date, time and datetime picker modes. The datepicker is customizable and is supporting different languages. It's written with native code to achieve the best possible look, feel and performance.
MIT License
2.14k stars 326 forks source link

How to change year BC to BE #811

Open shinnachot opened 1 month ago

shinnachot commented 1 month ago

Describe the bug I try to add year in moment +543 but i cannot pick a date on 29 february 2567

Expected behavior date picker should be select a date on 29 february 2567

import React from "react";
import DatePicker from "react-native-date-picker";
import { translate } from "../../plugins/i18n/action";
import { toBuddhistYear } from "../../utils";
import moment from "moment";
import { DatePickerProps } from "./datepicker.type";
import { memo } from "../../hooks/memo";

const DatePick: React.FC<DatePickerProps> = ({
  dateVisibility = false,
  selectDate = new Date(),
  onConfirm = () => {},
  onCancel = () => {},
}) => {
  return (
    <DatePicker
      modal
      open={dateVisibility}
      date={selectDate}
      mode="date"
      locale="th"
      maximumDate={new Date()}
      onConfirm={onConfirm}
      onCancel={onCancel}
    />
  );
};

export default memo(DatePick);

Smartphone (please complete the following information):