Created
September 4, 2018 19:50
-
-
Save aatronco/2be6ffd7ab7b8d551a70542e20872874 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var d = new Date() | |
var nDate = d.getTime() + 24 * 60 * 60 * 1000 ; | |
var start_date = new Date(nDate).toJSON().slice(0,10); | |
var min_hour = new Date(nDate).toJSON().slice(11,13); | |
// Cuando selecciona la fecha evalua si es menos de 24 horas hasta las 00:00, si esto ocurre deshabilita las horas que no corresponden | |
$("#checkout").change(function(){ | |
var parts = $("#order_other_fecha_del_despacho").val().split('-'); | |
var mydate = new Date(parseInt(parts[0]), parseInt(parts[1] - 1), parseInt(parts[2])); | |
var dif = mydate.getTime() - d.getTime() | |
if(dif < 86400000){ | |
$("#order_other_hora_del_despacho").children("option").filter(function() { | |
return parseInt(this.value.slice(0,2)) < parseInt(min_hour) -3; | |
}).prop("disabled", true); | |
}else{ | |
$("#order_other_hora_del_despacho").children("option").filter(function() { | |
return true; | |
}).prop("disabled", false); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment