Changing Color Background Color Based on Date

I am trying to make a cell in my template change colors when date of the tag is the same as Today's date. Both are string data types, it is too far to change the strings to date data types in the. I am dividing each value by the current date and adding them and was checking if the value was 3 and trying to change the color based on whether the value is 3 or not.


This is the expression I am using currently using, but I keep getting error messages that read.

"expression binding on BoltFail.BoltFail.Time.text"

Below is the template I am working in, the green cell i am wanting to change to only be green if the date is equal to today's current date.

The math could be eliminated by doing some date casting hocus pocus.

In this way, it's simple matter of comparing the displayed year, month, and day to now's year, month, and day.

// #toDate('Date String', failover Value)
// #using date format to filter out time information
if(dateFormat(toDate({Path.to.string.date}, None),'YYYY-MM-dd') = dateFormat(now(), 'YYYY-MM-dd'),
	toColor('green'), // #Green if date is today
	toColor('red'))  // #Red if date is something other than today
2 Likes

Thank you, that is a lot simpler and works well!!! :smiley:

1 Like