Personal Beauty,
I'm 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 am validating if the reported date is less than the current date. So far so good! It is validating correctly, the problem is when I inform the same day of the current date, there it falls in the validation.
And it's wrong, because the reported date (equal to current) is not less.
I do not understand much this date problem with JavaScript