Skip to content

Commit

Permalink
front: fix stdcm departure time on sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
Akctarus authored and SharglutDev committed Jun 17, 2024
1 parent 2050f03 commit 38f002e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 3 additions & 3 deletions front/src/applications/stdcm/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { extractTime } from 'utils/date';

import type { SimulationReportSheetProps } from './types';

function generateRandomString(length: number): string {
Expand Down Expand Up @@ -61,7 +59,9 @@ export function getOperationalPointsWithTimes(simulationReport: SimulationReport
}

const { positions, times } = simulation.final_output;
const departureTime = extractTime(simulationReport.stdcmData.departure_time);
const departureTime = new Date(simulationReport.stdcmData.departure_time)
.toLocaleTimeString()
.substring(0, 5);

// Parse departure time into hours and minutes
const [departureHour, departureMinute] = departureTime.split(':').map(Number);
Expand Down
4 changes: 0 additions & 4 deletions front/src/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,3 @@ export function convertUTCDateToLocalDate(date: number) {
const timeDifferenceMinutes = new Date().getTimezoneOffset();
return Math.abs(timeDifferenceMinutes) * 60 + date;
}

export function extractTime(isoDate: string) {
return dayjs(isoDate).utc().format('HH:mm');
}

0 comments on commit 38f002e

Please sign in to comment.