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 -2
View File
@@ -23,11 +23,15 @@ export default function ReportForm() {
}
}, [status]);
// Returns today's date as YYYY-MM-DD in Central US time
const getCentralToday = () =>
new Date().toLocaleDateString('en-CA', { timeZone: 'America/Chicago' });
const fetchReport = async () => {
try {
const res = await fetch("/api/reports");
const data = await res.json();
const today = new Date().toISOString().split('T')[0];
const today = getCentralToday();
const todayReport = data.find((r: any) => r.date.split('T')[0] === today);
if (todayReport) {
@@ -49,7 +53,7 @@ export default function ReportForm() {
const res = await fetch("/api/reports", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ managerName }),
body: JSON.stringify({ managerName, date: getCentralToday() }),
});
const data = await res.json();
setReport(data);