mirror of
https://fast.feibisi.com/https://github.com/parcelvoy/platform.git
synced 2025-09-01 12:26:08 +08:00
fix: journey date parsing
This commit is contained in:
parent
1c54973b13
commit
bdeaaaf4c8
2 changed files with 13 additions and 8 deletions
|
@ -165,7 +165,6 @@ const journeyStepsParamsSchema: JSONSchemaType<JourneyStepMapParams> = {
|
|||
}
|
||||
|
||||
router.get('/:journeyId/steps', async ctx => {
|
||||
console.log('run!')
|
||||
ctx.body = await getJourneyStepMapForUI(ctx.state.journey!)
|
||||
})
|
||||
|
||||
|
|
|
@ -210,6 +210,7 @@ export class JourneyDelay extends JourneyStep {
|
|||
this.hours = json?.data?.hours
|
||||
this.days = json?.data?.days
|
||||
this.time = json?.data?.time
|
||||
this.date = json?.data?.date
|
||||
this.exclusion_days = json?.data?.exclusion_days
|
||||
}
|
||||
|
||||
|
@ -262,13 +263,18 @@ export class JourneyDelay extends JourneyStep {
|
|||
}
|
||||
return nextDate
|
||||
} else if (this.format === 'date' && date) {
|
||||
const compiledDate = compileTemplate(date)({
|
||||
user: state.user.flatten(),
|
||||
journey: state.stepData(),
|
||||
})
|
||||
const localDate = crossTimezoneCopy(new Date(compiledDate), 'UTC', timezone)
|
||||
if (localDate < baseDate) return baseDate
|
||||
return localDate
|
||||
try {
|
||||
const compiledDate = compileTemplate(date)({
|
||||
user: state.user.flatten(),
|
||||
journey: state.stepData(),
|
||||
})
|
||||
const localDate = crossTimezoneCopy(new Date(compiledDate), 'UTC', timezone)
|
||||
if (localDate < baseDate) return baseDate
|
||||
return localDate
|
||||
} catch (error) {
|
||||
logger.error({ error, date, timezone }, 'journey:delay:parse:error')
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
return baseDate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue