From 1e8c204ed22f3624bd4f442355472f1b3f346969 Mon Sep 17 00:00:00 2001 From: gibbyb Date: Sun, 21 Jul 2024 18:45:35 -0500 Subject: [PATCH] Time acts different in dev env vs prod --- src/server/functions.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/server/functions.ts b/src/server/functions.ts index 0f6d64f..8ed40b2 100644 --- a/src/server/functions.ts +++ b/src/server/functions.ts @@ -9,16 +9,19 @@ export const getEmployees = async () => { }); }; -const convertToUTC = (date: Date) => { - return new Date(date.setHours(date.getUTCHours())+ 5); -}; +// Uncomment this and change updatedAt below if using localhost and you want correct time. +// I dont know why it is like this. +//const convertToUTC = (date: Date) => { + //return new Date(date.setHours(date.getUTCHours())+ 5); +//}; // Function to Update Employee Status using Raw SQL export const updateEmployeeStatus = async (employeeIds: string[], newStatus: string) => { try { // Convert array of ids to a format suitable for SQL query (comma-separated string) const idList = employeeIds.map(id => parseInt(id, 10)); - const updatedAt = convertToUTC(new Date()); + //const updatedAt = convertToUTC(new Date()); + const updatedAt = new Date(); // Do not change for PROD! It acts different on PROD // Prepare the query using drizzle-orm's template-like syntax for escaping variables const query = sql`