react-nice-dates icon indicating copy to clipboard operation
react-nice-dates copied to clipboard

Question: Is it possible to get the first and last dates the calendar will display on a given month?

Open alejo4373 opened this issue 4 years ago • 0 comments

I'm working on an app to visualize (highlight) my workdays in the calendar (they vary week to week). Right now, I fetch my workdays based on the month the calendar is set to. The challenge I'm facing is that if I work the week of September 27th (1 week before October) and want to see what days I'll be working the next week I have to advance the calendar month to October and my workday fetching functions will return the dates I'm working on October, and not September, and therefore the dates that display in the calendar from September won't be highlighted.

So, if the calendar had a way of communicating what is the start and end displayed date (for October 2021 that would be Sept 26 and Nov 6) I could use those dates to fetch my workdays in that range.

Screen Shot 2021-07-31 at 8 59 53 PM

I know that I could adjust my data fetching functions to always include one week before and one week after each month, but it would be quite convenient if the Calendar component offered the functionality I mentioned in the previous paragraph. Maybe the onMonthChange handler accepting a callback like (monthStartDate, startDisplayedDate, endDisplayedDate) => {...}??

✅ Also, really nice library! I'm interested in contributing, specially working on issue #3 if no one is already.

alejo4373 avatar Aug 01 '21 01:08 alejo4373