DatePickerPlugin

Cordova Date Picker Plugin (android and ios only)
kdileep19900.0.27
platforms: android,ios
$ cordova plugin add com.dileep.plugins.datepicker

DatePicker Plugin for android and ios using PhoneGap / Cordova 3.0

Installation

1) Make sure that you have Node and Cordova CLI or PhoneGap's CLI or Cordova Plugman installed on your machine.

2) 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" />

4) The clobber definition of the plugin is called datePicker. 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.

Options

mode

The mode of the date picker.

Typ: String

Values: "date" / "time" / "datetime"

Default: 'datetime'

date

Selected date.

Typ: String

Default: new Date()

allowOldDates

Shows or hide dates earlier then selected date.

Typ: Boolean

Values: true / false

Default: true

allowFutureDates

Shows or hide dates after selected date.

Typ: Boolean

Values: true / false

Default: true

Requirements

  • PhoneGap 3.0 or newer /Cordova 3.0 or newer
  • Android/iOs