@ramon @max @perry @siddhartha @mhartington cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker i used this plugin in my sample app
i am getting date and time picker when first time set the date and time not showing in view if again click the text box it shows previous date and time in view when user click the text box this method will be called $scope.calendarData = function() {
alert(“hi”);
var options = {
date: new Date(),
mode: 'date'
};
datePicker.show(options, function(date) {
var monthName = "";
switch (date.getMonth()) {
case 1:
monthName = "Jan";
break;
case 2:
monthName = "Feb";
break;
case 3:
monthName = "Mar";
break;
case 4:
monthName = "Apr";
break;
case 5:
monthName = "May";
break;
case 6:
monthName = "Jun";
break;
case 7:
monthName = "Jul";
break;
case 8:
monthName = "Aug";
break;
case 9:
monthName = "Sept";
break;
case 10:
monthName = "Oct";
break;
case 11:
monthName = "Nov";
break;
case 12:
monthName = "Dec";
break;
}
var day = "";
switch (date.getDay()) {
case 0:
day = "Sun";
break;
case 1:
day = "Mon";
break;
case 2:
day = "Tue";
break;
case 3:
day = "Wed";
break;
case 4:
day = "Thu";
break;
case 5:
day = "Fri";
break;
case 6:
day = "Sat";
break;
}
$scope.calendar.register = day + ", " + date.getDate() + " " + monthName + " " + date.getFullYear();
alert($scope.calendar.startTime);
var options1 = {
date: new Date(),
mode: 'time'
};
datePicker.show(options1, function(date) {
var format;
var hours;
if (date.getHours() < 12) {
hours = date.getHours();
format = "AM";
} else {
hours = date.getHours() - 12;
format = "PM";
}
$scope.register += " " + hours + ":" + date.getMinutes() + " " + format;
});
});
};
i binded date and time value to ng-model: $scope.register . here first i am getting time before getting the time i have to select the datepicker. In this situation Can i use call back functions here.How to write call back functions in ionic