javascriptreactjsreact-dates

Airbnb react-dates calendar with non-English locale


I am trying to use airbnb react-dates with non-English locale (Persian) and everything is working fine, except for the first day of the month.

The months do not start from the first day in Persian (Jalaali) calendar to the 30th day, they start from the 10th day of the month and continue to the 10th day of the next month.

This problem even exists in their example. I was wondering if there is any way to deal with this issue.


Solution

  • I have been dealing with this issue in a project,this problem is currently an open issue in airbnb react-dates. In order to solve this, I have forked the original project so that it works with jalali moment and the months start from the correct day,the link to the github and npm repositories are:

    how to use:

    import {SingleDatePicker,DateRangePicker} from "react-dates-jalali";

    Needless to say,this repositories support all other airbnb react-dates apis which are not mentioned here.

    You can also this repository if your site is multilingual and you can change the locale and month format whenever you want.