Moment() not updating timestamp value

let timestamp = {{moment().format('YYYYMMDD_HHmmss')}}
let filename = 'comps_' + timestamp + '.xlsx'
return filename

For the last hour the "filename" value has come back as "comps_20221229_125432.xlsx"

Why is this timestamp not updating with the current time? (edit: format is ok, the time is the issue)

What do you expect it to look like or be? Have you looked at: Format - momentjs.com

I'm expecting it to update with the current time. Format isn't an issue.

OK so you only want the current time not date month year? Or all of it in milliseconds?
{{moment.now()}}

I need current date and time, formatted as above, for whenever I call that query. If I run it 10 minutes from now, it shouldn't have the same timestamp as before. Is moment supposed to hold some arbitrary value and never update?

No it should not...
It works for me like so
{{moment().format('YYYYMMDD_HHmmss')}}
Screenshot 2022-12-29 at 2.45.43 PM
Screenshot 2022-12-29 at 2.45.35 PM

Not sure what's happening on your side to be honest.

Hi @fowlerjk

Are you still seeing this issue? How/where are you using this code? It sounds like it may not be getting re-evaluated when you need the updated value.

This works well in a JS query. Every time I click "Run" on the query, I get an updated time:

[video-to-gif output image]

However, in a transformer, I need some reason for the transformer to re-evaluate (i.e. re-saving it, updating a component that is referenced in the transformer, etc) otherwise it'll have the outdated time