Change date format in datepicker

0

My problem is as follows, from the database I receive the dates indicated in the following image (with the format of dmy)

But when you receive it in the datepicker, you take it in another format And this means that on this date you can not show it because you think it is from 06 of month 21, 2018 (date that does not exist)

                    <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

I hope you can help me:)

    
asked by david canche 04.07.2018 в 23:20
source

1 answer

0

This worked for me, I hope it works for any similar question

link

    
answered by 05.07.2018 / 00:27
source