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 do not want it to come out in this format
DateTitle 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 entered in the fields and using moment.js