0
I have the following form:
<form name="formConsultaPeriodo">
Data Inicial
<input class="form-control dataIni" type="date" name="dataIni" ng-model="consulta.dataInicial" required />
Data Final
<input class="form-control dataFim" type="date" name="dataFim" ng-model="consulta.dataFinal" required />
<a class="btn btn-success" ng-disabled="formConsultaPeriodo.$invalid" ng-click="consultaPeriodo(consulta)">Consultar</a>
</form>
My controller:
$scope.consultaPeriodo = function(consulta){
var dataInicial = consulta.dataInicial;
var dataFinal = consulta.dataFinal;
console.log("dataInicial "+dataInicial+" dataFinal "+dataFinal);
}
I don’t want it to come out in this shape
dataInitil Thu Jan 01 2015 00:00:00 GMT-0200 (-02) dataFinal Fri Jan 01 2016 00:00:00 GMT-0200 (-02)
I want to know how to format the dates typed in the fields and using Moment.js
So I would have to take the variable with the date and put it into Moment? That way? Moment("startData"). format('YYYY-MM-DD HH:mm:ss');
– GustavoSevero
That’s right, thanks Glauber
– GustavoSevero