JSFiddle - React, Tailwind, and code Playground

by hansvedo

HTML

<table border=1 data-date="2012-12-01">
    <tr><th>Student ID</th><th>Grade</th><th>Apply Recorrection</th></tr>
    <tr><td>RS211</td><td>C</td><td>Click Here</td></tr>
    <tr><td>RS221</td><td>B</td><td>Click Here</td></tr>
    <tr><td>RS251</td><td>F</td><td>Click Here</td></tr>
</table>

JavaScript

// Today
var time_now = $.now();

// The date set in the table's class.
var date_start = new Date($('table').attr('data-date'));

// The table's date turned into microseconds.
var time_start = date_start.getTime();

// The difference in days.
var date_difference = parseInt((time_now - time_start ) / (86400000));

// If the date difference is greater than X, hide the column.
if(date_difference > 12){
    $("table td:nth-child(3), table th:nth-child(3)").hide();    
}