Мне пришлось реструктурировать вашу таблицу HTML, чтобы заставить работать соответствующую js:
$(document).ready(function(){
$("button").click(function(){
$("p").slideToggle();
$('.hidden').toggle()
});
});
$(document).ready(function(e) {
$('.event_display_table tbody tr td:first-child').each(function(index, element) {
var event_day = $(this).text();
event_day = new Date(event_day);
// I added this which will set the time of "event_day" to 00:00:00
event_day.setHours(0,0,0,0)
var today = new Date();
// I added this which will set the time of "today" to 00:00:00
today.setHours(0,0,0,0)
if(event_day < today) {
$(this).parent().hide()
$(this).parent().addClass('hidden');
}
});
});
Отредактированный HTML:
<table class="event_display_table" border="1" >
<thead>
<tr>
<th>Date</th>
<th>Event</th>
</tr>
</thead>
<tbody>
<tr>
<td>2018-03-13</td>
<td>My event detail 1</td>
</tr>
<tr>
<td>2018-05-14</td>
<td>My event detail 2</td>
</tr>
<tr>
<td>2018-05-13</td>
<td>My event detail 3</td>
</tr>
<tr>
<td>2018-05-15</td>
<td>My event detail 4</td>
</tr>
<tr>
<td>2018-06-27</td>
<td>My event detail 5</td>
</tr>
<tr>
<td>2018-06-15</td>
<td>My event detail 6</td>
</tr>
</tbody>
</table>