Created
June 30, 2016 16:51
-
-
Save dannyvassallo/1c9acf4881ca64dc0f64d1e4eb14543f to your computer and use it in GitHub Desktop.
check if availability is today
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
<script type="text/javascript"> | |
<!-- | |
var ESTdateTime = '', | |
calDate = '', | |
unavailableDays = []; | |
// GET EST DATE TIME | |
function convertToServerTimeZone(){ | |
var offset = -5.0, | |
clientDate = new Date(), | |
utc = clientDate.getTime() + (clientDate.getTimezoneOffset() * 60000), | |
serverDate = new Date(utc + (3600000*offset)), | |
splitDate = serverDate.toLocaleString().split(','); | |
ESTdateTime = splitDate[0]; | |
} | |
function getDateFromAvailabilityCal(){ | |
var month = parseInt(jQuery('.edac-edacpicker-month').val()) + 1; | |
var year = parseInt(jQuery('.edac-edacpicker-year').val()); | |
jQuery('.edac-state-highlight').each(function(){ | |
var day = jQuery(this).html(); | |
var theDate = month+'/'+day+'/'+year; | |
unavailableDays.push(theDate); | |
}); | |
} | |
jQuery(function(){ | |
getDateFromAvailabilityCal(); | |
convertToServerTimeZone(); | |
jQuery.each(unavailableDays, function(index, unavailableDate) { | |
if(ESTdateTime === unavailableDate){ | |
jQuery('#unavailable-today').html("Unfortunately, Mandoli's is unavailable to take new orders for today, however you can still schedule a call and another completion date. Check forward through this calendar to make sure the date you'd need is still available."); | |
} | |
}); | |
}); | |
//--></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment