Open pedolsky opened 11 months ago
bump Same issue as with latest version
+1
Same issue, but I found a workaround. The object returned by helpers.relativeTime()
has a values
array. The date string is stored the 2nd element that array. So if you want to add to the string you can do for example:
[[[ return "Relative Time:<br>" +
helpers.relativeTime(entity.state).values[1]; ]]]
But I'm not sure if the helpers.relativeTime(entity.state).values
array is always the same.
+1, the .values[1] workaround is pretty ugly. I would like to have "Mi custom text: 4 hours ago" with '4 hours ago' being the text displayed by helpers.relativeTime(entity.state)
I can't get helpers.relativeTime() to work at all.. can somebody give me a hint at what's wrong? As a test I try this simple card, current time is past 07:15
type: custom:button-card
custom_fields:
text: >
[[[
return 'Relative Time: ' +
helpers.relativeTime('2024-08-18T07:15:00+00:00').values[1]
]]]
But my output is this:
Checklist
Describe the bug I can only use a single DateTime helper, the use of additional helpers or characters results in [object Object]
Version of the card Version: 4.1.1
To Reproduce This is the configuration I used:
Screenshots
Expected behavior I expected/hoped that it is possible to use multiple helpers in one.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Home Assistant Supervised core-2023.9.1