Calendar Report Showing Weekends in Leave Duration (Even When Leave is Only on Weekdays)

In our leave management setup, we calculate leave duration using only business days (excluding weekends). However, when we display the leave entries on a calendar report, the full date range including weekends is being highlighted. For example, a leave applied from Friday to next Tuesday shows Saturday and Sunday as part of the visual timeline, even though they aren't counted in the duration.

How can we configure the calendar to only highlight the actual business leave days?

Comments

  • Manisha_Decisions
    edited July 23

    Hi,

    One possible approach is to decouple the display timeline from the full date range and instead feed the calendar a refined list of only the business days.

    Here’s how you might go about it:

    1. Create a helper data structure
    2. Define a structure (say, Leave_WeekDay) that stores only the actual business days for each leave request. This structure would include one record per valid leave day, excluding weekends.
    3. Populate this structure when leave is submitted
    4. Use logic to calculate the in-between business days from the selected range, then insert entries into Leave_WeekDay, linking them to the main leave entry via a Leave ID.
    5. Update the Calendar Report Configuration
      • Set the calendar’s provider to use the weekday entries from Leave_WeekDay.
      • Use the original leave object only for labels, tooltips, or grouping fields like leave type, duration, etc.
    6. Edge Case to Watch For
    7. If the calendar is excluding the last day (even when it's selected), check whether the End Date is stored with a time like 00:00:00. You may need to add a slight time offset (e.g., 00:00:10) to ensure it’s included.

    If you're exploring this solution and want a working reference, a sample project demonstrating this pattern is attached. It’s meant to be instructional, not production-ready, but can help you understand the structure and flow logic.


Sign In or Register to comment.