Hello friends I want to compare two hours one that is value obtained from an id, and the other one built with the current time.
And two date also one that is value obtained from an id, and the other built with the current date where:
var HoraActual = $('input:text[id=COMD_FECHA]').val();//=> 10:04 AM
var FechaActual = $('input:text[id=COMD_FECHA_ATENCION]').val();//=> 09/10/2018
var fa = fe + "/" + (f.getMonth() + 1) + "/" + f.getFullYear();//=> 09/10/2018
var strTime = hours + ':' + minutes + ' ' + ampm;//=> 10:04 AM
var HoraActual = $('input:text[id=COMD_FECHA]').val();
var FechaActual = $('input:text[id=COMD_FECHA_ATENCION]').val();
var f = new Date();
var fe = "";
if (f.getDate() < 10) {
fe = "0" + f.getDate();
} else {
fe = f.getDate();
}
var fa = fe + "/" + (f.getMonth() + 1) + "/" + f.getFullYear();
var hours = f.getHours();
var minutes = f.getMinutes();
var ampm = hours >= 12 ? 'pm' : 'am';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0' + minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
if (FechaActual >== fa && HoraActual >== strTime ) {
alert("Fecha y Hora actual es mayor");
}
else {
alert("no son iguales");
}