Custom Button Card - as timestamp

Having trouble finding a way to leverage this template into a custom field in Custom Button card.

For instance, this is the template that works in Dev Tools
{{ as_timestamp (states.sensor.device.last_changed) | timestamp_custom('%H:%M',True) }}

Normally in Custom Button card I can do the following to get the state. However it does not like the as_timestamp portion, nor does it respect attributes.last_changed either. Any suggestions?

custom_fields:
  changed: |
    [[[
    var changed = states['sensor.device'].state;
    return (changed ? changed : '0');
    ]]]

If memory serves, I think it’s:

states['sensor.device'].last_changed

(or last_updated depending what you need)

Also, bear in mind that {{}} templates are totally different from [[[]]] templates. The first type is jinja and interpreted by the Home Assistant code. The second type is JavaScript running directly in the web browser. Different syntax and different objects available to work with.