This is a re-write of the iOS DatePicker plugin hosted on https://github.com/phonegap/phonegap-plugins/tree/master/iOS/DatePicker to run with PhoneGap/Cordova 3.0.html
It includes more options and it is ready for using on iPhone and iPad.node
Note: iOS6 only! For using iOS7 checkout the ios7 branchios
Also you will need Xcode v.4.2 or newer to support the feature called "Automatic Reference Counting"git
cordova plugin add https://github.com/sectore/phonegap3-ios-datepicker-plugin
Or using PhoneGap CLI:github
phonegap local plugin add https://github.com/sectore/phonegap3-ios-datepicker-plugin
Or using plugman CLI:web
plugman --platform ios --project ./platforms/ios --plugin https://github.com/sectore/phonegap3-ios-datepicker-plugin
3a) Register plugin within config.xml
of your appapache
<feature name="DatePicker"> <param name="ios-package" value="DatePicker"/> </feature>
3b) If you are using PhoneGap build service add to config.xml
xcode
<gap:plugin name="de.websector.datepicker" />
clobber
definition of the plugin is called datePicker
. So you can reference to the plugin from anywhere in your code.Example:app
// 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.ide
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
Minimum date.
Typ: Date
or empty String
Default: ''
(empty String)
Maximum date.
Typ: Date
or empty String
Default: ''
(empty String)
Label of done button.
Typ: String
Default: 'Done'
Hex color of done button.
Typ: String
Default: '#0000FF'
Label of cancel button.
Typ: String
Default: 'Cancel'
Hex color of cancel button.
Typ: String
Default: '#000000'
X position of date picker (iPad only). The position is absolute to the root view of the application.
Typ: String
Default: '0'
Y position of date picker (iPad only). The position is absolute to the root view of the application.
Typ: String
Default: '0'
Jens Krause // WEBSECTOR.DE