Reputation: 210
May be my question would be redundant but is there a solution to show native calendar style datepicker in ANDROID and IOS in Cordova/Phonegap apps. I have searched a lot for the solution but no luck. Only thing I found that there is a calendar style datepicker available in android atleast (not sure about IOS) as mentioned here http://android-er.blogspot.in/2013/06/options-for-datepicker-to-display-or.html. but no idea how to develop this in phonegap hybrid apps
I have tried HTML5 Input Date type but its shows as spinners.
I have an alternate solution to use jQueryMobile UI or similar controls but before I try these controls I want to be sure that showing native calendar style datepicker is not possible in hybrid apps. Does anybody have an solution for my requirement .
I have tried this plugin EddyVerbruggenCalendar-PhoneGap-Plugin but it is mainly for events and activites not for date selection.
Any help is highly appreciated. Thanks in advance.
Upvotes: 5
Views: 8871
Reputation: 567
I went through the same trouble and found a solution in the following link
How to get Calender view in corodva wrapper
So what you have to do is use the cordova-plugin-datepicker
in your mobile wrapper and then add the following code to your code.
this.datePicker.show({
date: new Date(),
mode: 'date',
androidTheme: 5
}).then(
date => console.log('Got date: ', date),
err => console.log('Error occurred while getting date: ', err)
);
Here android theme 5 is for light theme and 4 is for dark theme.
Upvotes: 0
Reputation: 53301
You have a lot of plugins for date pickers
Here you have some of them:
https://github.com/kdileep1990/com.dileep.plugins.datepicker/
https://github.com/VitaliiBlagodir/cordova-plugin-datepicker
You can search datepicker on plugins.cordova.io
http://plugins.cordova.io/#/search?search=datepicker
or on https://build.phonegap.com/plugins
Upvotes: 1
Reputation: 1
There is a easy way. Angular datepicker is an angularjs directive that generates a datepicker calendar on your input element. IOS or Android both OK. https://github.com/720kb/angular-datepicker
Upvotes: 0