fix: date filter for the same day showing appointments of the day before (#18579)

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
Anik Dhabal Babu
2025-01-10 15:42:24 +05:30
committed by GitHub
co-authored by Peer Richelsen
parent 88c8ad8b5c
commit d4d5ac2b28
2 changed files with 3 additions and 3 deletions
@@ -40,7 +40,6 @@ export const StartTimeFilters = () => {
minDate={null}
dates={{ startDate: startValue, endDate: endValue }}
onDatesChange={(values) => {
console.log(values);
const newAfterStartDate = values.startDate ? dayjs(values.startDate) : undefined;
const newBeforeEndDate = values.endDate ? dayjs(values.endDate) : undefined;
setAfterStartDate(newAfterStartDate);
@@ -1,5 +1,6 @@
import { Prisma as PrismaClientType } from "@prisma/client";
import dayjs from "@calcom/dayjs";
import { parseRecurringEvent, parseEventTypeColor } from "@calcom/lib";
import getAllUserBookings from "@calcom/lib/bookings/getAllUserBookings";
import logger from "@calcom/lib/logger";
@@ -187,7 +188,7 @@ export async function getBookings({
if (filters?.afterStartDate) {
bookingWhereInputFilters.afterStartDate = {
startTime: {
gte: new Date(filters.afterStartDate),
gte: dayjs(filters.afterStartDate).utc().endOf("day").toDate(),
},
};
}
@@ -195,7 +196,7 @@ export async function getBookings({
if (filters?.beforeEndDate) {
bookingWhereInputFilters.beforeEndDate = {
endTime: {
lte: new Date(filters.beforeEndDate),
lte: dayjs(filters.beforeEndDate).utc().startOf("day").toDate(),
},
};
}