Skip to content

Commit 43ed182

Browse files
committed
front: ensure correct timezone handling in date fields
- add 'Z' to dateTimeFormatting function to enforce UTC timezone interpretation
1 parent 7614d18 commit 43ed182

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

front/src/utils/date.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ export function dateTimeFormatting(date: Date, withoutTime: boolean = false) {
2626
default:
2727
dayjs.locale('en-gb');
2828
}
29+
const dateToUTC = dayjs(`${date}Z`); // The 'Z' is to ensure we have an UTC date
2930
const dateFormat = withoutTime ? 'D MMM YYYY' : 'D MMM YYYY HH:mm';
30-
return dayjs.utc(date).tz(dayjs.tz.guess()).format(dateFormat).replace(/\./gi, '');
31+
return dateToUTC.tz(dayjs.tz.guess()).format(dateFormat).replace(/\./gi, '');
3132
}
3233

3334
/** check whether a date is included in the range or not */

0 commit comments

Comments
 (0)