I'm trying to subtract a date that the user types in the input with the current date.
var data1 = $("#data_viagem").val();
var data1 = data1.split("/");
var viagem = new Date(data1[2], data1[1], data1[0]);
var dateObj = new Date();
var month = dateObj.getUTCMonth() + 1; //months from 1-12
var day = dateObj.getUTCDate();
var year = dateObj.getUTCFullYear();
I made these two blocks to put together the two dates, but I can not get through. I can not mount the current date to make a valid subtraction. I get wrong results.