Created
January 13, 2020 04:54
-
-
Save davidmroth/6bae027047ec6fa71e8b34d29b7cb193 to your computer and use it in GitHub Desktop.
Squarespace - Remove event date if between a specified 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
$(document).ready(function() { | |
var getTimeValue = function(time) { | |
return Date.parse('01/01/2011 ' + time); | |
} | |
var ignoreAfter = '12:00:00 AM'; | |
var ignoreBefore = '05:00:00 AM'; | |
var allEventTimes = $('.eventlist-meta-time'); | |
var test = allEventTimes.filter(function(idx, elm) { | |
var start = $(elm).find('.event-time-12hr .event-time-12hr-start').text(); | |
var end = $(elm).find('.event-time-12hr .event-time-12hr-end').text(); | |
if (start && end) { | |
if ( | |
(getTimeValue(start) >= getTimeValue(ignoreAfter)) && | |
(getTimeValue(end) <= getTimeValue(ignoreBefore)) | |
) { | |
$(this).addClass('hideTime'); | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment