Get relative time/date - Mushroom entity vs template

Hi All,

I know there are a bunch of topics on this but none seem to answer this specifically.
So I have a BMW EV that has a charge_end_time sensor. Basically, when it’s charging it displays when it expects the target charge percentage to be reached. When it’s not charging it displays when the vehicle was last charged.

I had this sensor displayed in a mushroom entity card which gave me a really nice human readable format both future and past. Like right now it’s not charging and the sensor shows ‘yesterday’. When I plug it in it says ‘in 4 hours’ to indicate when it will reach it’s charge.

I now want to switch this to a mushroom template card however. As I want the primary info to display wether or not it’s charging (different binary_sensor) and the secondary info to show this charge_end_time sensor. But when I now use a template to display the sensor it shows the timestamp value 2024-01-04T10:15:28+00:00

Reading some other posts I discovered i can somewhat replicate the nicer format using

{{ relative_time(as_datetime(states('sensor.ix1_xdrive30_charging_end_time'))) }}

2 downsides:

  • its not as nice. it doesn’t show ‘yesterday’ but instead shows ‘1 day’.
  • but more importantly, as I read in other posts and have confirmed using dev tools, once the timestamp is in the future relative_time no longer works, it just shows the timestamp again.

i’m assuming the nice human readable format is a mushroom entity card feature.
Does anyone know how this can be exactly replicated easily? If at all possible…

Or if I can keep using an entity card but show the primary info of one sensor and secondary info of another with the nice formatting?

Tnx!