Hey folks,
Running into a weird edge case with date math in Architect. I need to check if an interaction happened within the last 24 hours. I’ve got two date strings coming from a JSON payload:
{{interaction.timestamp}} // e.g., "2023-10-27T14:30:00Z"
{{system.current_timestamp}}
I’m using the DateTimeDiff expression to compare them. My logic looks like this:
DateTimeDiff('{{interaction.timestamp}}', '{{system.current_timestamp}}', 'hours')
If the result is less than 24, I route to queue A. Otherwise, queue B. The problem is when the interaction happens today. Sometimes the diff comes back negative, like -5, even though the current time is obviously after the interaction time. I assumed DateTimeDiff always returns an absolute positive value or handles the order of arguments intelligently.
Am I missing a parameter? Or do I need to wrap this in an If statement to handle the sign manually? I tried swapping the arguments, but that just flips the sign for yesterday’s interactions. Feels like I’m overcomplicating a simple “within 24 hours” check.
Any ideas?