stephy / CalendarPicker

CalendarPicker Component for React Native
802 stars 371 forks source link

fix: empty 1st row in Days Calendar #379

Closed shubhamjadon closed 4 months ago

shubhamjadon commented 5 months ago

Fixes #378

This issue was happening when firstWeekDay of month is 7 and firstDay prop value is 0 which make startIndex 7 but as per logic startIndex should be from 0 to 6, so this leads render of an empty row as first row.

Fix: Correct value of startIndex for this case should be 0. Hence added % 7 to restrict startIndex to be from 0 to 6.

peacechen commented 4 months ago

Thanks @shubhamjadon for contributing. Apologies for the delay, I missed this notification in my inbox. I added a suggestion in the code.