Changing out Date to Tomorrow/Today (DATETIME TO A STRING)

Using HABpanel I have created a status board for all the things going on in and around the house…one thing we have an issue remembering is when our larger “JUNK TRASH” pickups occur. @rlkoshak has been extrmely helpful in assisting me with an alerting rule that will send out notifications based on the upcoming event.

What I would like to further enhance is the display on the status board.

Currently if you look at the section for “Junk Trash” you can see the next pick up date.


This is the code that renders the above:

<h3 class=recycle-day> <img class="junk-icon" src={{ServerPath}}hab_icons/junk.png>{{itemValue('Calendar_Upcoming_Junk') | date: 'EEEE' }}</h3>
<h2 class=recycle-date> {{itemValue('Calendar_Upcoming_Junk') | date: 'MMMM d, yyyy' }}</h2> 

Now based upon what I’ve learned previously, I believe I know how to calculate tomorrow and today - what I want to do, is switch out the currently displayed day of the week (FRIDAY) with TOMORROW and TODAY on their appropriate days. I would also like to BLINK (i know groan) the text for these two days as well.

Thoughts and suggestions are always welcome and appreciated.


1 Like

Anyone have any suggestions??

I could tell you how to do it in Rules. I don’t use Habpanel so can’t help there.

I’m looking to do this in a rule…don’t think it needs to be specific to HabPanel.

    if(now.getDayOfWeek == pickupDay.getDayOfWeek) day = "Today"
    else if(now.getDayOfWee == pickupDay.getDayOfWeek - 1) day = "Tomorrow"
    else day = "Friday"