Last active
April 20, 2017 20:54
-
-
Save abrahamjuliot/a4830b41cd8adde453f8423c0b727c7b to your computer and use it in GitHub Desktop.
expire.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
// example: <li data-expire="April 17, 2017"></li> | |
var $elems = document.querySelectorAll('[data-expire]'), | |
today = new Date(); | |
for( | |
var el = 0, | |
len = $elems.length, | |
expire = null; | |
el < len; | |
el++) { | |
expire = new Date($elems[el].dataset.expire); | |
if (today.getTime()>expire.getTime()) { | |
$elems[el].style.display='none'; | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment