I have the following scenario. A form with two date fields
AndwhenIclickSearch,thedataisinthisformat
HowcanIgetthedateintheformat"yyyy-mm-dd" or "dd-mm-yyyy"? Without this additional data (Thu Oct, 00:00:00 GMT-0300), does anyone know?
Follow my HTML
form name="relatorioPorPeriodo" class="formRelatorio">
<input class="form-control dataini" type="date" name="data_ini" ng-model="relatorio.dataini" required>
<input class="form-control datafim" type="date" name="data_fim" ng-model="relatorio.datafim" required>
<a class="btn btn-success" ng-disabled="relatorioPorPeriodo.$invalid" ng-click="pesquisaPorPeriodo(relatorio)">Pesquisar</a>
</form>
Controller
app.controller("RelatorioPorPeriodoCtrl", ['$scope', '$http', '$window', '$rootScope', '$routeParams', 'moment', function ($scope, $http, $window, $rootScope, $routeParams, moment) {
$scope.idempresa = $rootScope.idempresa = localStorage.getItem('idempresa');
$scope.empresa = $rootScope.empresa = localStorage.getItem('empresa');
$scope.usuario = $rootScope.usuario = localStorage.getItem('usuario');
$scope.idusuario = $rootScope.idusuario = localStorage.getItem('idusuario');
$scope.pesquisaPorPeriodo = function(relatorio){
console.log(relatorio);
}
}]);