I would like to express the following expression in Google Sheets:

IF today's date is less than or equal to the last day of the current month (in this case October 2021), THEN output today's date, OTHERWISE output the last day of the month (i.e. October 31, 2021)

I've tried a few different ways but nothing seems to work. Below is my latest attempt, but I get an #ERROR.

```
=IF(TODAY(<=2021,10,31),TODAY(),DATE(2021,10,31))

```

Thank you in advance for your help.