This commit is contained in:
jason
2026-03-13 11:18:11 -05:00
parent b2df27cfc5
commit 0e2dc27779
2 changed files with 12 additions and 5 deletions
+6 -3
View File
@@ -37,9 +37,12 @@ export async function POST(req: Request) {
const body = await req.json();
const { managerName, date } = body;
// Check if a report already exists for this date and user
const reportDate = date ? new Date(date) : new Date();
reportDate.setHours(0, 0, 0, 0);
// Check if a report already exists for this date and user.
// Client always sends a YYYY-MM-DD date string in Central US time;
// we store it as UTC midnight so the date string is stable across timezones.
const reportDate = date
? new Date(`${date}T00:00:00.000Z`)
: new Date(new Date().toLocaleDateString('en-CA', { timeZone: 'America/Chicago' }) + 'T00:00:00.000Z');
let report = await prisma.report.findFirst({
where: {