Home > Forum > General > Advanced coloring date fields in reports

Advanced coloring date fields in reports
0

Hi there,
I'm trying to work out a rule to color backround of a date cell. The condition would be "if the date in the current field is greater than today, then color backround, else dont change the color". Currently the not working JSON code is:

{
"content": "=CurrentField",
"style": {
"background-color": "=if(CurrentField > today, '#FF0000', '')"
}
}

I've also tried different variants of the condition like "date(CurrentField) > date(today)" or "CurrentField > date('TODAY')" and other similar, but none worked. Please help :)

MVP

I'm digging an old thread, but I've faced same trouble today, and had to add something new to make it work, so why not make an update :)
This is my final config, that works for Date columns (i didn't need time part, changing today() to now() should do the work though)

{
"content": "=CurrentField",
"style": {
"background-color": "=if(date(CurrentRawValue) > today(), '#FF0000', '')"
}
}