/hide-after-date.js Secret
Last active
December 18, 2022 22:33
Show/Hide Based on Date/Time
This file contains 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
// ".before" is class to show before time, and ".after" is class to show after | |
window.setInterval(function() { | |
let current = new Date(); | |
let expiry = new Date("Mar 29, 2020 20:21:00") | |
if (current.getTime() > expiry.getTime()) { | |
$('.before').hide(); | |
$('.after').show(); | |
} else if (current.getTime() < expiry.getTime()) { | |
$('.before').show(); | |
$('.after').hide(); | |
} | |
}, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment