react-horizontal-datepicker icon indicating copy to clipboard operation
react-horizontal-datepicker copied to clipboard

Days of the month not shown.

Open panoshalios opened this issue 4 years ago • 0 comments

Hey,

The days of the month are not shown if the following conditions are met:

  1. You specify an endDate which is relatively small. E.G. <DatePicker className="justify-content-center" endDate={15} getSelectedDay={(daySelected) => dispatch({ type: 'appointment_date', payload: moment(daySelected) })} color="rgb(94,163,136)" />
  2. You are towards the end of the month. Today is the 20th of January. (Thus the endDate should be around the 4th of February)

I did a bit of debugging and found out that differenceInMonths (which is used in the code) calculates the difference in full months. Thus in our case, the difference will be zero since it is not a full month difference. This will only let the code try to render the days for the month of January and not February (bug number 1).

After that, the code is supposed to render the days but it takes the start date of 19 and the end date of 4 instead of the end date of the current month. it does the following check startDate < endDate to render the days, which obviously fails. (bug number 2).

I apologise if I misunderstood something.

panoshalios avatar Jan 20 '21 15:01 panoshalios