From 42d67a590645913d83741ac3ccc21348af7a067a Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Fri, 12 Jan 2024 20:23:28 +0800 Subject: [PATCH] time selection must be before 01/16/2024 --- src/server/api/routers/time-sel.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/server/api/routers/time-sel.ts b/src/server/api/routers/time-sel.ts index 8f8b87a..18a7bd5 100644 --- a/src/server/api/routers/time-sel.ts +++ b/src/server/api/routers/time-sel.ts @@ -119,9 +119,8 @@ export const toggleAttendance = async (ctx: Context, input: { periodId: number, if (!period) throw new TRPCError({ code: "NOT_FOUND", message: "Period not found" }); if (checkWeekInAdvance) { - const weekInAdvance = new Date(); - weekInAdvance.setDate(weekInAdvance.getDate() + 7); - if (period.date < weekInAdvance) throw new TRPCError({ code: "BAD_REQUEST", message: "Period is not a week in advance. Please contact HR." }); + const weekInAdvance = new Date("2024/01/16 23:59"); + if (new Date() > weekInAdvance) throw new TRPCError({ code: "BAD_REQUEST", message: "Time selection period has passed. Please contact HR." }); } if (input.attendance) {