Replace a date with 'Today' or 'Tomorrow'

I’ve created my own trash widget (hoehoe, my first one :smile: ) and I would like to replace the dates which are taking place today and tomorrow with the strings ‘today’ and ‘tomorrow’. The dates are gathered via the api of my ‘trash-company’, so I can do some magic in my rule to achieve this I suppose. But maybe there is an easier way? I don’t mind if the items doesn’t change, as long as the widget is changed, I’m happy.

I’ve already found this post of some years ago, but this doesn’t seems to work anymore (withTimeAtStartOfDay is undefined…):

If it’s just for display, consider a JS javascript transform. The script can extract date, see if it’s today or tomorrow and return the text, otherwise pass the date.

1 Like


Something similar allready exists, and Date-Calculation is inside as well :slight_smile:

I knew I saw this post in the past! thx for pointing me in the right direction. I’ll start immediately :slight_smile:

edit: done

How can i “transfer” this to the item?
I want to use the words “Today/Tomorrow” in the HABPanel widget.
I use this one and it does not make sense to write a script to calculate the day.