-1
I’m doing this job:
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>
But it returns me the following error:
Referenceerror: Invalid left-hand side in assignment
In this line:
$("#txtVencimentoC").val() = (atual_data1.format("dd/MM/yyyy HH:mm:ss"));
I tried to do it too but it didn’t work:
$("#txtVencimentoC").val(atual_data1.format("dd/MM/yyyy HH:mm:ss"));
I believe that if you move:
$("#txtVencimentoC").val() = (atual_data1.format("dd/MM/yyyy HH:mm:ss"));
for$("#txtVencimentoC").val((atual_data1.format("dd/MM/yyyy HH:mm:ss")));
remember thatval()
is to set a value and not receive with the allocation operator (=
)– rray
your problem https://stackoverflow.com/a/9132972/2740371
– Marco Souza
Uncaught Typeerror: actual_data1.format is not a Function
– Marco Souza