diff --git a/src/components/senior/DisplaySenior.tsx b/src/components/senior/DisplaySenior.tsx index 6837fb77..3f85149d 100644 --- a/src/components/senior/DisplaySenior.tsx +++ b/src/components/senior/DisplaySenior.tsx @@ -48,6 +48,12 @@ const DisplaySenior = (props: DisplayProps) => { seniorId: senior.id, }); }; + const seniorFiles = senior.Files.map((file) => { + const userTimeZoneOffset = new Date().getTimezoneOffset(); + const newDate = new Date(file.date.getTime() + userTimeZoneOffset * 60000); + const { date, ...other } = file; + return { date: newDate, ...other }; + }); return (
@@ -79,7 +85,7 @@ const DisplaySenior = (props: DisplayProps) => { setFileEdit={canAddFile ? setFileEdit : undefined} /> )} - elements={senior.Files.sort( + elements={seniorFiles.sort( (fileA, fileB) => fileA.date.getTime() - fileB.date.getTime() )} search={(file, filter) => formatFileDate(file.date).includes(filter)} @@ -88,7 +94,7 @@ const DisplaySenior = (props: DisplayProps) => { { const date = new Date(val); - date.setHours(0, 0, 0, 0); - date.toISOString(); + date.setUTCHours(0, 0, 0, 0); return date; }), filetype: z.string(),