-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add js to hide events with past dates (view only future)
- Loading branch information
1 parent
d9d7015
commit cf64d5e
Showing
4 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function getCompareDate() { | ||
var d = new Date(), | ||
month = '' + (d.getMonth() + 1), | ||
day = '' + d.getDate(), | ||
year = d.getFullYear(); | ||
if (month.length < 2) month = '0' + month; | ||
if (day.length < 2) day = '0' + day; | ||
return [year, month, day].join(''); | ||
} | ||
var elements = document.querySelectorAll('[future-date]'); | ||
Array.prototype.forEach.call(elements, function(el, i){ | ||
if(el.getAttribute('future-date').split('-').join('') < getCompareDate()) el.remove(); | ||
}); |