Ngcordova datepicker 'done' button doesn't close date picker


#1

Hi All,

I’m having an issue with the ngcordova datepicker closing. I’m using it to select a time however using having the ‘mode:’ set to date still doesn’t make it work for me.

After clicking done, the bar at the bottom that shows the done button disappears, however the datepicker stays open and the only way to cancel it, is using the cancel button, which does work however whatever value I select is lost, regardless of if I have it set to date or time. Has anyone else experienced this issue? I can’t find much information regarding the datepicker on the web, and can’t seem to find anyone else having the same issue as me when clicking done.

Here is the code I use to call the datepicker…

> $ionicPlatform.ready(function(){
>     $scope.showDatePicker = function(){
>        var options = {
>           date: new Date(),
>           mode: 'time',
>           minDate: new Date(),
>           allowOldDates: false,
>           allowFutureDates: true,
>           doneButtonLabel: 'Set Time',
>           doneButtonColor: '#F2F3F4',
>           cancelButtonLabel: 'CANCEL',
>           cancelButtonColor: '#000000'
>        };
>         
>          $cordovaDatePicker.show(options).then(function(date){
>           alert("Selected time: " + date);
>        });
>         
>    };
> });

Funnily enough as well, that I don’t believe to be pertinent to my issue is that you may notice I have the ‘doneButtonLabel’ set to be ‘Set Time’. The done button that appears doesn’t take on this string, instead it has the default value of ‘done’. Also as another side note, I have changed alert("selected time: " + date) for simplicity sake removing the .getTime afterwards just to see if it was because I was originally converting the date object into time, however neither work.

Any help on this issue is much appreciated.

Thanks


#2

Problem solved.

Turns out I wasn’t using the latest version of ionic/cordova IOS build so once I updated that all my issues were fixed.

Rookie Mistake!