Architect Expression: DateTimeDiff returning NaN for same-day comparisons

Trying to understand why my date comparison logic is failing in Architect. I’m pulling transcript timestamps from the Analytics API to feed into a sentiment model trigger. The goal is to flag calls where the sentiment score drops below a threshold within 24 hours of the last interaction.

The expression keeps evaluating to NaN or throwing a parse error when the start and end dates fall on the same calendar day. I’ve tried both DateTimeDiff and manual epoch subtraction.

Here’s the flow config:

actions:
 - type: "assign"
 name: "Set Time Diff"
 target: "timeDiffHours"
 expression: "DateTimeDiff(${interaction.endTime}, ${interaction.startTime}, 'hours')"
 - type: "condition"
 name: "Check 24h Window"
 condition: "${timeDiffHours} <= 24"

If startTime is 2023-10-27T14:00:00Z and endTime is 2023-10-27T15:00:00Z, the expression fails. The docs imply it handles ISO8601, but the parser seems choking on the timezone offset or the lack of day delta. Is there a specific format required for the inputs, or is DateTimeDiff just broken for intra-day comparisons? Need a workaround that doesn’t involve a complex Python lambda call for every interaction.

DateTimeDiff(DateTimeParse(startStr, ‘yyyy-MM-dd HH:mm:ss’), DateTimeParse(endStr, ‘yyyy-MM-dd HH:mm:ss’), ‘hours’)


I usually solve this by forcing explicit format strings in `DateTimeParse`. Architect's parser chokes on implicit formats, especially when timezone offsets are missing. If you're pulling raw analytics timestamps, ensure they're ISO 8601 compliant before passing them in. NaN usually means the parser gave up on the input string structure.