Cordova Plugin for showing a native date, time or datetime picker.
- iOS: use auto layout
- iOS: remove < iOS 7 support (UIActionSheet)
- iOS: remove custom modal picker type
- Android: fix minute spinner for setting minute interval
- Android: support Lollipop radial picker (no support for minute interval however)
- Android: overall refactor and improvements
- iOS: replace initWithWebView with pluginInitialize (deprecated in cordova-ios-4.0)
- rename repo to conform to npm/cordova plugin naming convention
cordova plugin add skwas-cordova-plugin-datetimepicker
or for latest
cordova plugin add https://github.com/skwasjer/skwas-cordova-plugin-datetimepicker.git
Android 4 and higher
iOS 8 and higher (tested with Xcode 7.2.3 and Xcode 8)
show(options, successCallback, errorCallback);
Name | Type | Android | iOS |
---|---|---|---|
mode | String | date , time , datetime |
date , time , datetime |
date | Date | required | required |
allowOldDates | boolean | - | supported |
allowFutureDates | boolean | - | supported |
minuteInterval | int | >= Honeycomb < Lollipop | supported |
locale | String | - | supported |
okText | String | - | supported |
cancelText | String | - | supported |
var myDate = new Date(); // From model.
cordova.plugins.DateTimePicker.show({
mode: "date",
date: myDate,
allowOldDates: true,
allowFutureDates: true,
minuteInterval: 15,
locale: "EN",
okText: "Select",
cancelText: "Cancel"
}, function(newDate) {
// Handle new date.
...
}, function (err) {
// Handle error.
console.error(err);
});