Skip to content

kdileep1990/com.dileep.plugins.datepicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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" />
  1. 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