I need some assistance with what appears to be a straightforward task. Unfortunately, I lack the expertise required to solve this issue.
Essentially, I have a form where I pick a date (for the due date) using jQuery's datepicker. The outcomes are then displayed on another page in a table along with other work orders.
I am struggling to determine how to identify whether the date shown in the table is overdue or not and adjust the CSS if the date is earlier than today's date. Due to the presence of multiple rows in the table, each containing a due date that needs to be assessed, I am finding this challenging.
<table>
<tr>
<td class="dueDate">November 1, 2012</td>
</tr>
<tr>
<td class="dueDate">November 4, 2012</td>
</tr>
<tr>
<td class="dueDate">November 26, 2012</td>
</tr>
</table>
This layout depicts the table when the form is visible. It represents my best attempt at determining whether the displayed date precedes today's date.
$('.dueDate').each(function(){
var dueDate = $(this).val();
var today = new Date();
if (Date.parse(dueDate) < Date.parse(today)){
$(".dueDate").addClass("pastDue");
}
});
However, this solution is proving ineffective. Any suggestions?