-1
I own a field that receives a date, from that date it should add up to 1 month
//Funcao das datas
function addData() {
//Pegar data Atual para somar
var currentDate = new Date();
//pegar data atual para exibir
var currentDate1 = new Date();
//Capturar Quantidade de meses
var meses = "1";
//Parse Int dos meses
var a = parseInt(meses);
//Adicionar meses
currentDate.setMonth(currentDate.getMonth()+a);
//Trazer data Atual
currentDate1.setDate(currentDate1.getDate());
//Exibir data Atual
document.getElementById('data').value = currentDate1.toLocaleDateString();
//Exibir a data ja atualizada
document.getElementById('dataAtualizada').value = currentDate.toLocaleDateString();
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<label>Data</label>
<input type="text" id="data" value="">
<br>
<label>Data Atualizada</label>
<input type="text" id="dataAtualizada" value="">
<br>
<input type="button" onclick="addData()" value="Calc">
I took a code that adds but from the current date, I need it to capture the date that is in the "text" field and not the current one.
Example there is a "text" field with the following date Date 10/10/2018
Updated date 10/11/2018