How to change daysUntil date formatting dynamically

Hey Everyone,

Is it possible to change the daysUntil date formatting dynamically to weeksUntil, or monthsUntil ?

For example, I have the following scenario:
I have a select input with 3 options: Daily, Weekly, Monthly called repeatFrequency
I have a datetime variable displaying the current datetime called varTimeNow
I have a datepicker input called endDate
And I have an input called recurranceFrequency that calculates the number of times a certain action should run based on the inputs above.

I would like to have the recurranceFrequency input to be calculated automatically when the endDate field value is updated. This would be easy to do if I needed to calculate only for daily frequency, as I could have used

dmx-bind:value="varTimeNow.datetime.daysUntil(endDate.value)">

However I need to know if I can change the daysUntil part of the expression dynamically based on the repeat frequency selection. Is this possible?

If not the only alternative I can think of is to create 3 inputs for recurranceFrequency and show only one of them based on the repeatFrequency selection

Community Page
Last updated: