Using Flex Table cannot reparse date time

Hi All

I am using Flex Cable Card and o365 Integration to put together a todo list for HA dashboard, I am struggling to convert the due by date into simple dd/mm/yyyy format and could really do with some help.

Ive created two due by columns - 1st is original value from the sensor and 2nd is the to be date value only but I get Nan/Nan/Nan

Below is the code


type: custom:flex-table-card
entities:
  include: sensor.shopping_list_outlook*
columns:
  - name: subject
    data: all_tasks
    modify: x.subject
    icon: mdi:check-outline
  - name: Due By
    data: all_tasks
    modify: x.due
  - name: Due By
    data: all_tasks
    modify: |-
      if(x.due == 0){"-"} else { var date = new Date(x); date.getDate()+"/"+
      (String(date.getMonth()+ 1).padStart(2,'0'))+"/"+ date.getFullYear() }

image

Many Thanks

Jazz

Please post your code formatted - otherwise people have to guess what is wrong in it.
Use triple “`”.

Here is a solution:

1 Like

I got the author of the addon to amend the date/time input so this is now resolved!