From 80973c508f207003ba7e11f6520ccfa0374c2f19 Mon Sep 17 00:00:00 2001 From: bloussou Date: Wed, 21 Aug 2024 09:40:16 +0200 Subject: [PATCH] stdcm: increase pathfinding timeout --- .../modules/conflict/components/ConflictCardV2.tsx | 11 ++++++----- front/src/utils/date.ts | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/front/src/modules/conflict/components/ConflictCardV2.tsx b/front/src/modules/conflict/components/ConflictCardV2.tsx index b89995b84d5..98fe0127da7 100644 --- a/front/src/modules/conflict/components/ConflictCardV2.tsx +++ b/front/src/modules/conflict/components/ConflictCardV2.tsx @@ -15,7 +15,8 @@ const ConflictCardV2 = ({ onConflictClick: (conflict: ConflictWithTrainNames) => void; }) => { const { t } = useTranslation(['operationalStudies/scenario']); - + const start_time = formatToIsoDate(conflict.start_time, true); + const end_time = formatToIsoDate(conflict.end_time, true); return (
{t(`${conflict.conflict_type}`)}

-
- {formatToIsoDate(conflict.start_time, true)} +
+ {start_time}
-
- {formatToIsoDate(conflict.end_time, true)} +
+ {end_time}
diff --git a/front/src/utils/date.ts b/front/src/utils/date.ts index 9c6627382c9..5770a6762a3 100644 --- a/front/src/utils/date.ts +++ b/front/src/utils/date.ts @@ -12,6 +12,8 @@ dayjs.extend(utc); dayjs.extend(timezone); dayjs.extend(customParseFormat); +const userTimeZone = dayjs.tz.guess(); // Format : 'Europe/Paris' + /** * @param dateTimeString date string in ISO format * @returns string "HH:MM:SS" @@ -59,8 +61,7 @@ export function dateTimeFormatting( // Force interpreting the date in UTC const dateToUTC = dayjs(date).utc(isUTC); const dateFormat = withoutTime ? 'D MMM YYYY' : 'D MMM YYYY HH:mm'; - const tz = dayjs.tz.guess(); - return dateToUTC.locale(locale).tz(tz).format(dateFormat).replace(/\./gi, ''); + return dateToUTC.locale(locale).tz(userTimeZone).format(dateFormat).replace(/\./gi, ''); } /** @@ -73,7 +74,6 @@ export const dateTimeToIso = (inputDateTime: string) => { // Regex to check format 1234-56-78T12:00:00(:00) const inputDateTimeRegex = /^\d{4}-\d{2}-\d{2}[T\s]\d{2}:\d{2}(?::\d{2}){0,1}$/; if (inputDateTimeRegex.test(inputDateTime)) { - const userTimeZone = dayjs.tz.guess(); // Format : 'Europe/Paris' return dayjs.tz(inputDateTime, userTimeZone).format(); } return null; @@ -85,7 +85,6 @@ export const dateTimeToIso = (inputDateTime: string) => { * @return an ISO 8601 date (e.g. 2024-04-25T08:30:00+02:00) */ export const formatToIsoDate = (date: number | string, formatDate: boolean = false) => { - const userTimeZone = dayjs.tz.guess(); // Format : 'Europe/Paris' const format = formatDate ? 'D/MM/YYYY HH:mm:ss' : ''; return dayjs.tz(date, userTimeZone).format(format); };