I'm using JS to pull content from a table and create event list items on a page.
Im using Date.parse
to compare the entry date to todays date, and only show events in the future, based on MM/DD/YY value from var eventDate
.
<script>
today = new Date(); today.setDate(today.getDate() - 1);
eventDate = $(this).find("td:nth-child(3)").text().trim();
if (Date.parse(eventDate) > Date.parse(today)) {
//Do something...
}
</script>
I was thrilled to see how simple Date.parse was to use, then realized it only worked in Chrome (not in Firefox or IE). Any other ways to do this cross browser? Any thoughts would be appreciated. Thanks!