Skip to content

Instantly share code, notes, and snippets.

@abrahamjuliot
Last active April 20, 2017 20:54
Show Gist options
  • Save abrahamjuliot/a4830b41cd8adde453f8423c0b727c7b to your computer and use it in GitHub Desktop.
Save abrahamjuliot/a4830b41cd8adde453f8423c0b727c7b to your computer and use it in GitHub Desktop.
expire.js
(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