File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
apps/webapp/app/components/primitives/charts Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -36,17 +36,21 @@ export function formatChartDateLong(date: Date): string {
3636}
3737
3838/**
39- * Convert a Date to ISO date string (YYYY-MM-DD)
39+ * Convert a Date to ISO date string (YYYY-MM-DD) using local date components
4040 */
4141export function toISODateString ( date : Date ) : string {
42- return date . toISOString ( ) . split ( "T" ) [ 0 ] ;
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 } ` ;
4346}
4447
4548/**
46- * Parse an ISO date string to a Date object
49+ * Parse an ISO date string (YYYY-MM-DD) to a local Date object
4750 */
4851export function parseISODateString ( isoString : string ) : Date {
49- return new Date ( isoString + "T00:00:00" ) ;
52+ const [ year , month , day ] = isoString . split ( "-" ) . map ( Number ) ;
53+ return new Date ( year , month - 1 , day ) ;
5054}
5155
5256/**
You can’t perform that action at this time.
0 commit comments