CSR-1558: fix date ranges for API calls
This commit is contained in:
parent
68c3a2b8f3
commit
8623a3c0fc
1 changed files with 7 additions and 3 deletions
|
|
@ -94,7 +94,7 @@ const getAvailableDates = async (
|
|||
const timeSlotsData = {};
|
||||
timeSlotsData.days = [];
|
||||
let apiStartDate = startDateString;
|
||||
let apiEndDate = apiEndDateLimit;
|
||||
let apiEndDate = endDateString;
|
||||
|
||||
for (let i = 1; i <= apiCallsCount; i++) {
|
||||
let storeActionConfig;
|
||||
|
|
@ -106,6 +106,10 @@ const getAvailableDates = async (
|
|||
if (i === apiCallsCount) {
|
||||
apiEndDate = endDateString;
|
||||
}
|
||||
} else {
|
||||
if (apiEndDate > apiEndDateLimit) {
|
||||
apiEndDate = apiEndDateLimit;
|
||||
}
|
||||
}
|
||||
|
||||
if (appointmentType === AppointmentTypeStrings.MOBILE) {
|
||||
|
|
@ -127,13 +131,13 @@ const getAvailableDates = async (
|
|||
},
|
||||
};
|
||||
}
|
||||
storeActionConfigs.push(storeActionConfig);
|
||||
if (apiStartDate < apiEndDate) storeActionConfigs.push(storeActionConfig);
|
||||
}
|
||||
|
||||
// ASYNC METHOD
|
||||
const timeSlotsResponsesData = {
|
||||
days: [],
|
||||
};
|
||||
|
||||
function compareDayStrings(a, b) {
|
||||
if (a.date < b.date) return -1;
|
||||
if (a.date > b.date) return 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue