In this episode, we tackle a pretty important bug with our core availability feature: the app is showing available slots for past dates, even though users shouldn't be able to book them! We walk through a real example where, after navigating the calendar, dates prior to today are still appearing as available—even though they can't be selected.
We dig into the logic inside our schedule availability class and see exactly why this is happening: our system is adding availabilities for dates starting from the schedule's start date, regardless of whether that date is in the past. So, if the schedule starts on the 10th and today is the 19th, it's still technically showing slots for the 10th and onward.
To fix this, we add a simple check to ensure that availability is only shown for today or later, not for any day before. After updating the code, we test again and confirm that only current and future slots are visible to users. It's a nice, quick fix to stop users from seeing irrelevant past availability in the booking calendar!