How to compare date range in field styles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017 11:27 AM
Hi Experts,
I am trying to build a query that if due date is between today and tommorow , then that record be shown with red color.
doing this in System UI ---> Field Styles
Came up with this condition
javascript: gs.dateDiff(gs.now(),current.u_due_date.getDisplayValue(), true) > 0
but not able to setup for range between today and tommorow.
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2017 03:27 AM
I think i am able to get the values of dates in repective fields as due date is date time field
Not sure if its going wrong in if loop
if((updDate==now)||(updDate>=now.addDaysUTC(1)))
{
return true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2019 09:26 AM
Hi Deepansh,
dateDiff() method expects the earlier date as the first parameter and the later date as the second parameter; otherwise, the method returns the difference as a negative value and ultimately gives bad results.
Change your code like this-
javascript: gs.dateDiff(current.u_due_date.getDisplayValue(, gs.now().getDisplayValue(), true) >0;
Here, Earlier date = current.u_due_date.getDisplayValue() AND later date is gs.now().getDisplayValue()
Use getDisplayValue() to convert the strings to the expected format.
javascript: gs.dateDiff(String startDate, String endDate, Boolean numericValue);
Regards,
Shubham
