Update schedule.vue

change time 00:00:00 to current time because  converting 00 to UTC changing date to previous day.
This commit is contained in:
hiteshkumar87 2023-07-11 13:03:04 +05:30
parent 97f19af041
commit 2f58660694

View file

@ -81,8 +81,11 @@ const getAvailableDates = async (
appointmentType,
providerNumber
) => {
const apiEndDateLimit = new Date(startDateString + "T00:00:00");
const endDate = new Date(endDateString + "T00:00:00");
var today = new Date();
var currentTime = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
const apiEndDateLimit = new Date(startDateString + "T" + currentTime);
const endDate = new Date(endDateString + "T" + currentTime);
apiEndDateLimit.setDate(apiEndDateLimit.getDate() + TIME_SLOTS_CALL_DAYS_LIMIT);
// how many days are between startDate and endDate?
@ -90,7 +93,7 @@ const getAvailableDates = async (
const apiCallsCount = Math.ceil(difference / TIME_SLOTS_CALL_DAYS_LIMIT);
const storeActionConfigs = [];
const timeSlotsData = {};
let apiStartDate = new Date(startDateString + "T00:00:00");
let apiStartDate = new Date(startDateString + "T" + currentTime);
let apiEndDate = apiEndDateLimit;
timeSlotsData.days = [];
@ -104,7 +107,7 @@ const getAvailableDates = async (
apiEndDate.setDate(apiEndDate.getDate() + TIME_SLOTS_CALL_DAYS_LIMIT);
}
if (i === apiCallsCount) {
apiEndDate = new Date(endDateString + "T00:00:00");
apiEndDate = new Date(endDateString + "T" + currentTime);
}
if (appointmentType === AppointmentTypeStrings.MOBILE) {