I tried to make a function to add to that date, days coming from a parameter passed in the function. Below the function:
function montaDataSubstituicaoPrestador(){
var exclusao = new Date('2014-03-14T23:54:00');
var novadata = new Date();
var p = 60;
//lblTeste
novadata.setDate(exclusao.getDate() + p);
alert(exclusao);
alert(p);
alert(novadata);
}
I changed the function, because the date that should have come by parameter, was giving error of NaN
. I removed the second parameter too, which would be the summed days, but this was correct, I changed to the "P", but that's not the problem. It turns out that no alert(exclusao)
is coming with NaN
and of course novadata
is also coming like this. How do I add days to a date in js? I took it from colleague Morrison, here .