bilal114 / react-date-range-calendar

react calendar for choosing the date range
ISC License
6 stars 0 forks source link

calendar shows the current month even if you have selected two months later date range #1

Open sam89-web opened 5 years ago

sam89-web commented 5 years ago

Actually I am opening this calendar in a modal, that pops up when user clicks on an tag element.

If user selects the date by clicking on the dates on the calendar then it works fine,

But if we pass the default selected dates like having selectedRange=[] with values two or three months later than current month, In that case on opening the calendar it shows the current month as it should show the month that contains the date range.

let me explain it a little more , to make the issue a bit more clearer to you.

I am using this calendar to select the range of dates to book hotel between two dates, On our landing page when user selects the dates and then click the search button then we take our user to the the results page, and put the dates in the URL, On the results page we are getting the same date range values from the URL and passing them in the calendar's selectedRange=[] prop , then calendar selects the date range without any problem but when user opens the calendar on the results page then it always shows the current month first, Unfortunately because of that user have to go manually to the selected date range month by navigating through the next/previous button. So please resolve this issue.

Thanks!

mohyulasar commented 5 years ago

Hi @sam89-web, Please simply paste the following lines in scripts.js file at line number 111 in 'IF condition of selected_values['startDate']' **

var SavedMonth = today.getMonth(); var SavedYear = today.getFullYear(); currentYear2 = SavedYear; currentYear1 = SavedYear; currentMonth1 = SavedMonth; currentMonth2 = SavedMonth;

** I hope this will resolve you issue. Best Regards, Mohy ul Asar Rana

bilal114 commented 5 years ago

Hi thanks to all of you for taking your time to share your thoughts and issues with us.

As we are trying to do our best to make this calendar component as better as possible.

Solution: we have noted down your issue , and we will publish the solution of this problem by the end of October, 2019 in our next minor changes version that is going to be 0.1.14. After publishing that version we will let you know. Thanks!

bilal114 commented 5 years ago

I am sorry for the delay. The issue has been fixed and updated to the 0.1.14 version. please update your calendar's version. Thanks!