custom-cards / flex-table-card

Highly Flexible Lovelace Card - arbitrary contents/columns/rows, regex matched, perfect to show appdaemon created content and anything breaking out of the entity_id + attributes concept
GNU General Public License v3.0
198 stars 23 forks source link

Add Duration as a standard formatter #85

Closed Veejer closed 1 year ago

Veejer commented 1 year ago

I had originally added this to issue #75 but I don't think anyone is really implementing any of those suggestions. So I am creating a separate ticket for this.

I would like a formatter created and named 'duration'. It should takes an integer of Seconds and convert that to a duration, formatted like HH:MM:SS. Here are some examples: 18,563 seconds = 5:09:23 563 seconds = 9:23 23 seconds = 23 0 seconds = blank

As a separate but related formatter, I would like a 'duration-h' created. This should return the same value as 'duration' but with one difference. If the hours portion is greater than 24, then the number of days would be shown. Here is an example: 91,815 = 1d 1:30:15 90,015 = 1d 0:00:15