Moment.js not respecting .format in date selector

Hey all,

We had a few apps that recently broke (2 weeks or so ago I'd guess) that were using this in the date selector as a default value

{{moment().startOf('month').format('MM-DD-YYYY')}}
and
{{moment().subtract(1,"Days").format("MM-DD-YYYY")}}

This should format the date into a "01-01-2024" string but instead it keeps spitting out "2024-01-01T00:00:00.000-0800"

If I put that code into any JS transformer or JS query it comes out right its just when being used as the default value in a date picker that it seems to go off the rails. Has anyone else seen this or found a way around this? I need the correct format as its being fed into SQL as a date variable and it is super not happy with that T in there.

Hey @tvbel! Submitted a report so that our core engineering team can take a look at this. In the interim, I'd suggest reformatting the component value where you are passing it into the SQL query.

Let me know if you have any issues implementing this. I'll update you here as I get any additional information from the team on the bug report.

I have been doing that in our SQL codes by re-calling moment.js when setting the variables. I appreciate this being looked at as a bug as I thought I was losing my mind.

1 Like