Skip to content

Commit

Permalink
stdcm: increase pathfinding timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bloussou committed Aug 26, 2024
1 parent 3eecd56 commit 80973c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
11 changes: 6 additions & 5 deletions front/src/modules/conflict/components/ConflictCardV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div
className="conflict-card"
Expand All @@ -35,11 +36,11 @@ const ConflictCardV2 = ({
<p>{t(`${conflict.conflict_type}`)}</p>
</div>
<div className="conflict-times">
<div className="start-time" title={formatToIsoDate(conflict.start_time, true)}>
{formatToIsoDate(conflict.start_time, true)}
<div className="start-time" title={start_time}>
{start_time}
</div>
<div className="end-time" title={formatToIsoDate(conflict.end_time, true)}>
{formatToIsoDate(conflict.end_time, true)}
<div className="end-time" title={end_time}>
{end_time}
</div>
</div>
</div>
Expand Down
7 changes: 3 additions & 4 deletions front/src/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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, '');
}

/**
Expand All @@ -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;
Expand All @@ -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);
};
Expand Down

0 comments on commit 80973c5

Please sign in to comment.