diff --git a/src/api/announcements.ts b/src/api/announcements.ts index 50f3f2a..185f73b 100644 --- a/src/api/announcements.ts +++ b/src/api/announcements.ts @@ -7,14 +7,17 @@ export const getCurrentAnnouncements = async ( const payload = await getPayload(); const today = new Date(); + const todayDay = new Date(today.getFullYear(), today.getMonth(), today.getDay()); return await payload.find({ collection: "announcement", sort: "from", where: { or: [ - { from: { equals: today } }, - { and: [{ from: { less_than_equal: today } }, { to: { greater_than_equal: today } }] }, + { from: { equals: todayDay } }, + { + and: [{ from: { less_than_equal: todayDay } }, { to: { greater_than_equal: todayDay } }], + }, ], }, pagination: false, diff --git a/src/api/holidays.ts b/src/api/holidays.ts index 570a928..791eba9 100644 --- a/src/api/holidays.ts +++ b/src/api/holidays.ts @@ -7,14 +7,17 @@ export const getCurrentHolidays = async ( const payload = await getPayload(); const today = new Date(); + const todayDay = new Date(today.getFullYear(), today.getMonth(), today.getDay()); return await payload.find({ collection: "holiday", sort: "from", where: { or: [ - { from: { equals: today } }, - { and: [{ from: { less_than_equal: today } }, { to: { greater_than_equal: today } }] }, + { from: { equals: todayDay } }, + { + and: [{ from: { less_than_equal: todayDay } }, { to: { greater_than_equal: todayDay } }], + }, ], }, pagination: false, diff --git a/src/api/vacations.ts b/src/api/vacations.ts index 1fc7153..303590c 100644 --- a/src/api/vacations.ts +++ b/src/api/vacations.ts @@ -7,14 +7,17 @@ export const getCurrentVacations = async ( const payload = await getPayload(); const today = new Date(); + const todayDay = new Date(today.getFullYear(), today.getMonth(), today.getDay()); return await payload.find({ collection: "vacation", sort: "from", where: { or: [ - { from: { equals: today } }, - { and: [{ from: { less_than_equal: today } }, { to: { greater_than_equal: today } }] }, + { from: { equals: todayDay } }, + { + and: [{ from: { less_than_equal: todayDay } }, { to: { greater_than_equal: todayDay } }], + }, ], }, pagination: false,