2
I have a date field form, date. At 1a. time I select a date and click save, this warning appears on the console:
My HTML:
<div class="col-md-12" ng-controller="SaldoCtrl">
<form name="formSaldo" class="formSaldo">
<input class="form-control dataSaldo" type="date" name="dataSaldo" ng-model="saldo.data">
<select class="form-control descricaoSaldo" name="descricaoSaldo" ng-model="saldo.descricao" required>
<option value="">Selecione...</option>
<option value="Caixa">Caixa</option>
<option value="Tesouraria">Tesouraria</option>
<option value="Saldo Bancário">Saldo Bancário</option>
<option value="Diversos">Diversos</option>
</select>
<select class="form-control saldoFormaPgto" name="formaPgto" ng-model="saldo.formaPgto" required>
<option value="">Selecione forma pgto.</option>
<option value="Dinheiro">Dinheiro</option>
<option value="Cheque á vista">Cheque á vista</option>
<option value="Cheque á prazo">Cheque á prazo</option>
<option value="Outros valores">Outros valores</option>
</select>
<input class="form-control saldoValor" type="text" name="valorsaldo" ng-model="saldo.valor" required>
<a class="btn btn-success" ng-disabled="formSaldoBancario.$invalid" ng-click="salvarSaldo(saldo)">Salvar</a>
</form>
</div>
My controller:
app.controller("SaldoCtrl", function ($scope, $http, $window, $rootScope, $filter) {
$scope.salvarSaldo = function(saldo){
if(saldo.data){
var data = $filter('date')(saldo.data, 'yyyy-MM-dd');
saldo.data = data;
}else{
var data = new Date();
var data = $filter('date')(data, 'yyyy-MM-dd');
}
saldo.data = data;
saldo.idempresa = $scope.idempresa;
saldo.opcao = "Adicionar saldo";
console.log(saldo);
}
});
Which way out of
console.log( typeof $filter('date')(saldo.data, 'yyyy-MM-dd') )
?– BrTkCa
It returns a string...
– GustavoSevero