using javascript:condition in the "Value field" of "Field Styles : what syntax can i use to compare two date

isabelle74
Giga Contributor

Hi All,

 

I want to defined a style by using javascript:condition in the "Value field" of "Field Styles" to set the background color. i don't what is the right syntax to compare two .

Exemple :

In a task i want a red color in a list if closed>due-date and  a green color if closed<=due-date

 

Thanks & Regards,

Isabelle

6 REPLIES 6

Alikutty A
Tera Sage

Hello,

Can you try this out and see if it works

javascript:gs.dateDiff(current.closed_at.getDisplayValue(), current.due_date.getDisplayValue(), true) > 0

Please change your column names as it exist.

I have tested and it was working, please set this as your Value. Create 2 different styles

One with value as 

javascript:gs.dateDiff(current.closed_at.getDisplayValue(), current.due_date.getDisplayValue(), true) > 0

and other with value as

javascript:gs.dateDiff(current.closed_at.getDisplayValue(), current.due_date.getDisplayValue(), true) < 0

And set up your color styling accordingly.

Thanks!

Have you tried this out?

Hello Mark

 

Thanks a lot for your answer but unfortunately it doesn't work . 

i give you what i have done in "field style" and the result .

Could you help me again ?

Thanks a lot 

Isabelle

 

find_real_file.png

 

find_real_file.png

find_real_file.png