react-native-calendar-kit icon indicating copy to clipboard operation
react-native-calendar-kit copied to clipboard

Allow Customization or Removal of Event Date Range Limit

Open ttruongatl opened this issue 1 year ago • 0 comments

Description:

Hi there! First of all, thank you for creating such an amazing calendar library. I've been using it in my project, and it has been a great help so far.

However, I noticed that the EventsProvider seems to limit the range of events it processes to about 14 days in the past and 21 days in the future by default. After reviewing the code, I found that the notifyDataChanged function uses offset and pagesPerSide to calculate this range:

const minUnix = zonedDate.minus({ days: offset * pagesPerSide }).toMillis();
const maxUnix = zonedDate.plus({ days: offset * (pagesPerSide + 1) }).toMillis();

While this works for most cases, my use case requires processing events without such restrictions or with a larger range.

Questions:

  1. Is there currently a way to customize or remove this range limit?

    • For example, can we pass props or configuration to extend or completely disable this limit when consuming the library?
  2. Are there plans to make this range configurable in future releases?

    • It would be helpful if offset and pagesPerSide could be set through props or context.

Proposed Solution (Optional):

If there's no such option yet, I’d suggest the following improvements:

  1. Allow consumers of the library to pass a rangeLimit or similar prop to EventsProvider or the calendar component.

    • Example:
      <CalendarKit
        rangeLimit={{
          pastDays: 90,
          futureDays: 90,
        }}
      />
      
  2. Provide a way to completely disable the limit and fetch all events.

    • Example: Setting rangeLimit to null or Infinity.

Looking forward to hearing your thoughts on this. Please let me know if there’s any workaround in the meantime. Thanks again for your work on this awesome library! 🙌

ttruongatl avatar Jan 06 '25 14:01 ttruongatl