From 72952209ee8b5a2c3fff8f6a0ebe90b393e2626c Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 13 May 2025 16:11:49 -0400 Subject: [PATCH] CASH-690: fix view more dates error --- .../date-picker/date-picker.vue | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/digital-components/date-picker/date-picker.vue b/src/digital-components/date-picker/date-picker.vue index 1a7df91e0..ecb83fc36 100644 --- a/src/digital-components/date-picker/date-picker.vue +++ b/src/digital-components/date-picker/date-picker.vue @@ -688,17 +688,18 @@ export default { if (!this.months) return; this.isLoading = true; let monthToShow; - let monthStartDateNum = 0; + let monthStartDate; if (this.hideSomeDaysForInitialView) { monthToShow = this.months.find( ({ isMonthThatHidesSomeDaysForInitialView }) => isMonthThatHidesSomeDaysForInitialView ); + // find the first day-hidden to become the next api call start date - monthStartDateNum = - monthToShow.dates.find(({ dayClasses }) => dayClasses.includes("day-hidden")) - .dateNum - 1; + monthStartDate = monthToShow.dates.find(({ dayClasses }) => + dayClasses.includes("day-hidden") + ); } else { if (this.calendarViewDirection === "future") { monthToShow = this.months.find((month) => @@ -713,9 +714,13 @@ export default { } } if (monthToShow) { + const monthStartDateString = monthStartDate + ? monthStartDate.inputValue + : monthToShow.dates[0].inputValue; + // make new API call with this month's start and end dates const moreSelectableDatesData = await this.updateSelectableDates( - monthToShow.dates[monthStartDateNum].inputValue, + monthStartDateString, monthToShow.dates[monthToShow.dates.length - 1].inputValue ); this.isLoading = false;