I need to add a date, from a "purchase date" and days by expiration date.
No console.log
I am capturing the data I need, but at the time of the sum of the date it is generating an incorrect date.
function addDays(){
var data = $('#dataCompra').val();
var dias = $('#tipoproduto').val();
console.log(dias);
var result = new Date(data);
console.log(data);
console.log(dias);
result.setDate(result.getDate() + dias);
console.log(result);
$('#dataValidade').val(result);
};
</script>
On a date that was to add 5 days, which was the value typed and captured on the console, it calculates an unexpected date:
5
2016-10-10
5
Date 2017-01-03T23:00:00.000Z
Can anyone help me?