Expression syntax invalid near ‘==’. Expected numeric result. The routing condition fails validation when comparing dates. We’ve adjusted the syntax, yet the parser still returns a mismatch error.
Environment specs:
- Architect v2.14
- US/Pacific settings
Code:
DateTimeDiff(GetDayOfWeek({system.date}), “2024-10-31”, “day”) == 0
Should we wrap the string differently? Docs don’t explain how GetDayOfWeek parses raw dates. Queue metrics aren’t updating either. Weird. We’re just trying to skip Friday routing.
GetDayOfWeek returns a number (1-7), so you can’t diff it against a date string. Just use GetDayOfWeek({system.date}) == 6 for Friday.
is spot on. The parser is throwing a fit because DateTimeDiff expects two datetime objects, not a number and a string. You’re mixing data types.
If you just need to route based on the day of the week, drop the diff entirely.
GetDayOfWeek({system.date}) == 6
That’s Friday. Saturday is 7. Sunday is 1. It’s way cleaner too.
If you actually need to calculate the difference in days between today and a specific date for some other logic, you have to pass valid datetime strings to DateTimeDiff.
DateTimeDiff({system.date}, "2024-10-31T00:00:00", "day") == 0
Note the T and time component. The API is picky about ISO 8601 formats. But for a simple day-of-week check, stick to the numeric comparison. Saves you from parsing headaches later.