Skip to content

Commit 7b1a4e1

Browse files
committed
fix(frontend): ensure consistent date formatting across browsers
Use manual date component construction instead of toISOString() which can cause timezone-related inconsistencies in date display. This ensures the date picker displays the correct local date regardless of browser timezone settings.
1 parent 29bd8c3 commit 7b1a4e1

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

frontend/src/components/ProjectManagement.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,19 @@ export default function ProjectManagement({
104104
() => {
105105
const d = new Date();
106106
d.setDate(d.getDate() - 60);
107-
return d.toISOString().slice(0, 10);
107+
const y = d.getFullYear();
108+
const m = String(d.getMonth() + 1).padStart(2, "0");
109+
const day = String(d.getDate()).padStart(2, "0");
110+
return `${y}-${m}-${day}`;
108111
},
109112
);
110113

111114
const [tasksEndDate, setTasksEndDate] = useState<string | undefined>(() => {
112-
return new Date().toISOString().slice(0, 10);
115+
const d = new Date();
116+
const y = d.getFullYear();
117+
const m = String(d.getMonth() + 1).padStart(2, "0");
118+
const day = String(d.getDate()).padStart(2, "0");
119+
return `${y}-${m}-${day}`;
113120
});
114121

115122
const prevDateRangeRef = useRef<string>("");

0 commit comments

Comments
 (0)