-
Make sure that you have Node and Cordova CLI or PhoneGap's CLI or Cordova Plugman installed on your machine.
-
Add a plugin to your project using Cordova CLI:
cordova plugin add https://github.com/kdileep1990/com.dileep.plugins.datepicker
Or using PhoneGap CLI:
phonegap local plugin add https://github.com/kdileep1990/com.dileep.plugins.datepicker
3a) Register plugin within config.xml
of your app
Android
<feature name="DatePicker">
<param name="android-package" value="com.dileep.plugins.datepicker.DatePickerPlugin"/>
</feature>
iOS
<feature name="DatePicker">
<param name="ios-package" value="DatePicker"/>
</feature>
3b) If you are using PhoneGap build service add to config.xml
<gap:plugin name="com.dileep.plugins.datepicker" />
- The
clobber
definition of the plugin is calleddatePicker
. So you can reference to the plugin from anywhere in your code.
Example:
// defining options
var options = {
date: new Date(),
mode: 'date'
};
// calling show() function with options and a result handler
datePicker.show(options, function(date){
console.log("date result " + date);
});
Check section "Options" below to see all options.
The mode of the date picker.
Typ: String
Values: "date"
/ "time"
/ "datetime"
Default: 'datetime'
Selected date.
Typ: String
Default: new Date()
Shows or hide dates earlier then selected date.
Typ: Boolean
Values: true
/ false
Default: true
Shows or hide dates after selected date.
Typ: Boolean
Values: true
/ false
Default: true
- PhoneGap 3.0 or newer /Cordova 3.0 or newer
- Android/iOs