I'm doing this function:
function toDate(data) {
let partes = data.split('/');
return new Date(partes[2], partes[1] - 1, partes[0]);
}
var atual_data1 = toDate($("#txtDataInicio").val());
$("#txtVencimentoC").val() = (atual_data1.format("dd/MM/yyyy HH:mm:ss"));
var tol = ($("#txtTolerancia").val());
atual_data1.setDate(atual_data1.getDate() + parseInt(tol));
$("#txtDataTolerancia").val(atual_data1.format("dd/MM/yyyy HH:mm:ss"));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Butitreturnsmethefollowingerror:
ReferenceError:Invalidleft-handsideinassignment
Inthisline:
$("#txtVencimentoC").val() = (atual_data1.format("dd/MM/yyyy HH:mm:ss"));
I've tried to do this too but it did not work:
$("#txtVencimentoC").val(atual_data1.format("dd/MM/yyyy HH:mm:ss"));