Use javascript/jquery to see if items in list are due soon in Sharepoint 2013 -


i trying determine date if item due. in use case, user create item date in following format (mm/dd or 06/15). if date user chooses fall in next 30 days or month turn red. if date fall within next 60 days or less (until reaches 30) orange , if greater 60 yellow.

so clarify, if date <= 30 days today's date turn red , on...

i looking date.js perform these calculations unsure of how started.

what thinking far following:

var _duedate = currentitem.dateneeded; //not sure if correct syntax sharepoint development var = date();  var nowplus30 = new date(); nowplus.setdate(now.getdate() + 30);  var nowplus90 = new date(); nowplus.setdate(now.getdate() + 90);  if (_duedate == '' || !_duedate) {     return ''; }  , using values change background color example:    if( _duedate <= nowplus30 ) //find data use determine color             {                 x[i].parentnode.style.backgroundcolor = 'orange'; // set color             } 

but doing these each condition has not worked far think using date.js may again, no idea how proceed , because can't use sharepoint designer use built in conditional statements have use javascript operation. have asked think more of javascript issue having opposed sharepoint issue.

please help!

while don't mention how retrieving data sharepoint, once due date value, can create date object this

var duedate = '4/15'; var dparts = duedate.split('/'); var year = ("20" + dparts[1]) * 1; //converts string number var month = dparts[0] * 1; var _duedate = new date(year,month,1); 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -