Why does this compare Date formula not work?

Hi, Im trying to run a formula that returns true if the variable holding a specific date is equal to yesterday’s date. For some reason I cant get this to work right in formulas or javascript even when using copilot.

Can anyone see what I’m missing here? The endDate variable is at the bottom. For reference, in the picture below Jan 8th should be yesterdays date:

I think you need to make it only the date, as date() returns a datetime. By converting it to date, you get JUST the date, and not the time which causes the function to evaluate it as next day basically. Because it’s a difference of less than a day. Probably it’s rounding.

So basically just use formatDate(addDays(date() , -1), "YYYY-MM-DD") to get the 2024-02-09 instead of the daydate.