I think you need to create a variable first and then compare with that value. See this forum question for the approach https://forum.mendix.com/link/questions/6256 .
I hope this helps.
Consider using the DaysBetween function and store this in a variable to determine the amount of days between 2 dates – https://docs.mendix.com/refguide/between-date-function-calls/
You could try the function