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:
co-authored by
Peer Richelsen
parent
88c8ad8b5c
commit
d4d5ac2b28
@@ -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(),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user