Date / Time conversion as return value in button-card

Hi guys!

At the moment, I have a template sensor, which calculates the remaining program time for my Home Connect dishwasher.

- unique_id: washer_remaining_time
        name: "Remaining Time"
        icon: mdi:dishwasher
        state: >-
          {% set f = states('sensor.geschirrspuler_remainingprogramtime') %}
          {{ '00:00:00' if f == None else (as_datetime(f) - now()).total_seconds() | timestamp_custom('%H:%M', false) }}

I want to calculate the remaining program time directly in the card.

I use the following code:

- type: 'custom:button-card'
        template: card_power_outlet
        variables:
          ulm_card_power_outlet_consumption_sensor: sensor.geschirrspuler_leistung
          ulm_card_power_outlet_name: Geschirrspüler
          ulm_popup_power_outlet_sensor1: sensor.geschirrspuler_leistung
          ulm_popup_power_outlet_sensor2: sensor.geschirrspuler_energie
          ulm_popup_power_outlet_graph_sensor: sensor.geschirrspuler_leistung
          ulm_outlet_power_enable_popup: true
        entity: switch.geschirrspuler
        custom_fields:
            item1:
              card:
                custom_fields:
                  item2:
                    card:
                      label: >
                        [[[
                            return "An • " + (Math.round(states['sensor.geschirrspuler_leistung'].state * 100) / 100) + " W • " + ((as_datetime(states['sensor.geschirrspuler_remainingprogramtime'].state) - now()).total_seconds() | timestamp_custom('%H:%M', false)) + "h verbleibend";
                        ]]]

but getting the error:

So my question: Is it not possible to calculate the time directly in the card because of the missing js function?

Thanks
Dominik