Converting date issues?

I create a datetime variable called dateVar (interval: minutes) on a page. I then have another variable called adjustedDate.

When the page loads, adjustedDate value is set to:
dateVar.datetime.addDays(-7).formatDate('yyyy-MM-dd')
or:
image

This works.

However when the selects value is changed I have the following and it sets adjustedDate back today’s date when the value of the select is 1? It’s working when the value is 2 or 3, only when i set it back to the option with a value of 1 does it not work.

(value == 1)?dateVar.datetime.addDays('-7').formatDate('yyyy-MM-dd'):(value == 2)?dateVar.datetime.formatDate('MM/01/yyyy'):dateVar.datetime.addMonths(-1).formatDate('MM/dd/yyyy')

the select:
image

dateVar.datetime.addDays('-7')

should be dateVar.datetime.addDays(-7) - there should be no quotes around the value.

That fixed the issue… however i don’t know how the quote marks got in there. I used the gui to create… ::man_shrugging:

actually, it is the gui adding the quotes around -7. Just edited the date format and before clicking select, checked the code view. The quotes were back. Changed the add days option to a number, still added the quotes. Not sure if it’s a bug or somewhere else that’s adding them but wappler is doing it, not me.