Skip to content

Commit e15d4c3

Browse files
author
Allaoua Benchikh
committed
Send dates instead of date with time / timezone
1 parent 477ac27 commit e15d4c3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

frontend/src/components/ChatSettings/DatePickerInput.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import { InputStateHandler } from './InputStateHandler';
2424
const parseDate = (dateStr: string | undefined | null): Date | undefined => {
2525
if (!dateStr) return undefined;
2626
try {
27-
const date = new Date(dateStr);
27+
// Append T00:00:00 to force local timezone parsing instead of UTC
28+
const date = new Date(dateStr + 'T00:00:00');
2829
// Check if date is valid (Invalid Date has NaN time)
2930
if (isNaN(date.getTime())) {
3031
console.warn(`Invalid date string provided: "${dateStr}"`);
@@ -38,7 +39,10 @@ const parseDate = (dateStr: string | undefined | null): Date | undefined => {
3839

3940
const formatDateValue = (date: Date | undefined): string | undefined => {
4041
if (!date) return undefined;
41-
return date.toISOString();
42+
const year = date.getFullYear();
43+
const month = String(date.getMonth() + 1).padStart(2, '0');
44+
const day = String(date.getDate()).padStart(2, '0');
45+
return `${year}-${month}-${day}`;
4246
};
4347

4448
const formatRangeValue = (

0 commit comments

Comments
 (0)