Skip to content

Commit d4ad536

Browse files
committed
fixup! front: remove opTimingData from StdcmOpSchedule and simplify date management
1 parent c6a47d0 commit d4ad536

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

front/tests/utils/setup-utils.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import dayjs from 'dayjs';
2+
13
import type {
24
Infra,
35
PostInfraRailjsonApiResponse,
@@ -137,6 +139,10 @@ export async function createStudy(projectId: number, studyName = globalStudyName
137139

138140
return study;
139141
}
142+
143+
const createDateInSpecialTimeZone = (dateString: string, timeZone: string) =>
144+
dayjs.tz(dateString, timeZone);
145+
140146
/**
141147
* Main function to create all necessary test data including infrastructure, rolling stocks,
142148
* project, study, and scenario.
@@ -177,8 +183,14 @@ export async function createDataForTests(): Promise<void> {
177183

178184
const stdcmEnvironment = {
179185
infra_id: smallInfra.id,
180-
search_window_begin: new Date('2024-10-17T00:00:01+02:00').toISOString(),
181-
search_window_end: new Date('2024-10-18T23:59:59+02:00').toISOString(),
186+
search_window_begin: createDateInSpecialTimeZone(
187+
'2024-10-17T00:00:00',
188+
'Europe/Paris'
189+
).toISOString(),
190+
search_window_end: createDateInSpecialTimeZone(
191+
'2024-10-18T23:59:59',
192+
'Europe/Paris'
193+
).toISOString(),
182194
timetable_id: scenarioTrainSchedule.timetable_id,
183195
} as StdcmSearchEnvironment;
184196

0 commit comments

Comments
 (0)