Need some help troubleshooting expression syntax for date comparisons in architect since coming from twilio functions where i’d just do new Date().getDay(), the gc builder is throwing a type mismatch on GetDayOfWeek(timestamp()) == 1. is DateTimeDiff(timestamp(), "now", "d") the only way to get a numeric day index or am i missing a cast function? docs are vague on GetDayOfWeek return types
The simplest way to resolve this is that GetDayOfWeek returns a string, so you need to compare it to "1" instead of the integer 1. the docs state “returns the day of the week as a string (1-7)”, which is why the type mismatch happens.
I normally fix this by converting the string to an int before comparing. it’s cleaner than string matching if you’re doing math later.
# architect expression
ToInt(GetDayOfWeek(timestamp())) == 1
works every time for my sentiment triggers.