Mi problema es el siguiente, desde la base de datos recibo las fechas indicadas en la siguiente imagen (con el formato de dmy)
Pero al recibirla en el datepicker la toma en otro formato
Y esto hace que en esta fecha no pueda mostrarla pues piensa que es del 06 del mes 21, 2018 (fecha que no existe)
<div class="col-xs-9">
<p class="input-group">
<input class="form-control" type="text" id="date" name="date" uib-datepicker-popup="{{Reportes.format}}" ng-model="Reportes.alumnObtain.fecha_nac" is-open="Reportes.opened" min-date="Reportes.minDate" max-date="'2019-12-22'" uib-datepicker-options="Reportes.dateOptions"
date-disabled="Reportes.disabled(date, mode)" close-text="Close" />
<span class="input-group-btn">
<button class="btn btn-default" type="button" ng-click="Reportes.open($event)">
<em class="fa fa-calendar"></em>
</button>
</span>
</p>
@*<input class="form-control" type="text" ng-model="Reportes.alumnObtain.fecha_nac" />*@
</div>
datepicker
table.today = function() {
table.dt = new Date();
};
table.today();
table.clear = function () {
table.dt = null;
};
// Disable weekend selection
table.disabled = function(date, mode) {
return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
};
table.toggleMin = function() {
table.minDate = table.minDate ? null : new Date();
};
table.toggleMin();
table.open = function ($event) {
$event.preventDefault();
$event.stopPropagation();
table.opened = true;
};
table.dateOptions = {
formatYear: 'yy',
startingDay: 1
};
table.initDate = new Date('2019-10-20');
table.format = 'dd/MMMM/yyyy';
//end datepicker
Espero puedan ayudarme :)
Reportes.format
?angular.module('App') .controller('ReportesController', function ($state, $scope, $http, $compile, $window, $timeout, $resource) { var table = this; table.format = 'dd/MMMM/yyyy'; }
uib-datepicker-popup="{{Reportes.format}}"
... porque sólo deberías especificar que formato de fecha quieres y se mostrará asíuib-datepicker-popup='yyyy-MM-dd'
, etc