1
Personal Beauty,
I am trying to validate if an informed date is less than the current date..
var dtVenc = '22/10/2018'; /* Aqui recebe a data String do Json*/
function retornaData(data){
if(!data){
return data;
}
split = data.split('/');
return new Date( split[1] + "/" +split[0]+"/"+split[2] );
}
var dataCurrente = new Date();
if(retornaData(dtVenc).getTime() < dataCurrente.getTime()){
alert("A data informada é inferir a data atual");
}
I’m validating if the date is less than the current date. So far, so good! It is validating correctly, the problem is when I report the same day of the current date, ai falls into validation.
And it is wrong, because the informed date (equal to the current one) is no less.
I don’t understand, much this date problem with Javascript