Skip to content

Instantly share code, notes, and snippets.

@dannyvassallo
Created June 30, 2016 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannyvassallo/1c9acf4881ca64dc0f64d1e4eb14543f to your computer and use it in GitHub Desktop.
Save dannyvassallo/1c9acf4881ca64dc0f64d1e4eb14543f to your computer and use it in GitHub Desktop.
check if availability is today
<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