-
-
Save nocodesupplyco/8408d2eb3e1e487252d3de6a7f4007a1 to your computer and use it in GitHub Desktop.
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