Date Dynamic Default dates

I am using the Date component to narrow search results.

Its default is currently set to:

{{ new Date(moment()) }}

How would I go about setting this as default to the first of the previous month, and another Date component to the first of this month?

Thanks

Hi Aran! I believe you can use the .startOf method that moment provides (docs here)

so for the first of the month:

moment().startOf('month')

and for the first of the previous month:

moment().subtract(1,'months').startOf('month')

Let me know if that works!

2 Likes

Thanks Victoria!!