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:

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:

Community Page
Last updated: