Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.

Commit bdeaaaf

Browse files
committed
fix: journey date parsing
1 parent 1c54973 commit bdeaaaf

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

apps/platform/src/journey/JourneyController.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ const journeyStepsParamsSchema: JSONSchemaType<JourneyStepMapParams> = {
165165
}
166166

167167
router.get('/:journeyId/steps', async ctx => {
168-
console.log('run!')
169168
ctx.body = await getJourneyStepMapForUI(ctx.state.journey!)
170169
})
171170

apps/platform/src/journey/JourneyStep.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ export class JourneyDelay extends JourneyStep {
210210
this.hours = json?.data?.hours
211211
this.days = json?.data?.days
212212
this.time = json?.data?.time
213+
this.date = json?.data?.date
213214
this.exclusion_days = json?.data?.exclusion_days
214215
}
215216

@@ -262,13 +263,18 @@ export class JourneyDelay extends JourneyStep {
262263
}
263264
return nextDate
264265
} else if (this.format === 'date' && date) {
265-
const compiledDate = compileTemplate(date)({
266-
user: state.user.flatten(),
267-
journey: state.stepData(),
268-
})
269-
const localDate = crossTimezoneCopy(new Date(compiledDate), 'UTC', timezone)
270-
if (localDate < baseDate) return baseDate
271-
return localDate
266+
try {
267+
const compiledDate = compileTemplate(date)({
268+
user: state.user.flatten(),
269+
journey: state.stepData(),
270+
})
271+
const localDate = crossTimezoneCopy(new Date(compiledDate), 'UTC', timezone)
272+
if (localDate < baseDate) return baseDate
273+
return localDate
274+
} catch (error) {
275+
logger.error({ error, date, timezone }, 'journey:delay:parse:error')
276+
throw error
277+
}
272278
}
273279

274280
return baseDate

0 commit comments

Comments
 (0)