forked from VitaliiBlagodir/cordova-plugin-datepicker
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc7ba4e
commit 1dd2da7
Showing
1 changed file
with
49 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,140 +1,102 @@ | ||
# DatePicker Plugin for Cordova/PhoneGap 3.0 (iOS and Android) | ||
|
||
This is a re-write of the iOS DatePicker plugin hosted on [https://github.com/phonegap/phonegap-plugins/tree/master/iOS/DatePicker](https://github.com/phonegap/phonegap-plugins/tree/master/iOS/DatePicker) to run with PhoneGap/Cordova 3.0. | ||
|
||
It includes [more options](#options) and it is ready for iPhone and iPad. | ||
This is a combined version of DatePicker iOS and Android plugin for Cordova/Phonegap 3.0. | ||
Original iOS version: https://github.com/sectore/phonegap3-ios-datepicker-plugin | ||
Original Android version: https://github.com/bikasv/cordova-android-plugins/tree/master/datepicker | ||
|
||
## Installation | ||
|
||
1) Make sure that you have [Node](http://nodejs.org/) and [Cordova CLI](https://github.com/apache/cordova-cli) or [PhoneGap's CLI](https://github.com/mwbrooks/phonegap-cli) or [Cordova Plugman](https://github.com/apache/cordova-plugman/) installed on your machine. | ||
|
||
Also you will need Xcode v.4.2 or newer to support the feature called ["Automatic Reference Counting"](http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_2.html) | ||
|
||
2) Add a plugin to your project using [Cordova CLI](https://github.com/apache/cordova-cli): | ||
|
||
```bash | ||
cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker | ||
``` | ||
|
||
Or using [PhoneGap CLI](https://github.com/mwbrooks/phonegap-cli): | ||
|
||
```bash | ||
phonegap local plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker | ||
``` | ||
|
||
3) The `clobber` definition of the plugin is called `datePicker`. So you can reference to the plugin from anywhere in your code. | ||
|
||
Example: | ||
## Example | ||
|
||
```js | ||
// 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); | ||
alert("date result " + date); | ||
}); | ||
``` | ||
|
||
Check section ["Options"](#options) below to see all options. | ||
|
||
## Options | ||
|
||
### mode | ||
### mode - iOS, Android | ||
The mode of the date picker. | ||
Type: String | ||
Values: `date` | `time` | `datetime` | ||
Default: `datetime` | ||
|
||
Typ: `String` | ||
|
||
Values: `"date"` / `"time"` / `"datetime"` | ||
|
||
Default: `'datetime'` | ||
|
||
### date | ||
### date - iOS, Android | ||
Selected date. | ||
|
||
Typ: `String` | ||
|
||
Type: String | ||
Default: `new Date()` | ||
|
||
### allowOldDates | ||
Shows or hide dates earlier then selected date. | ||
|
||
Typ: `Boolean` | ||
### minDate - iOS, Android | ||
Minimum date. | ||
Type: Date | empty String | ||
Default: `(empty String)` | ||
|
||
Values: `true` / `false` | ||
### maxDate - iOS, Android | ||
Maximum date. | ||
Type: Date | empty String | ||
Default: `(empty String)` | ||
|
||
### allowOldDates - iOS | ||
Shows or hide dates earlier then selected date. | ||
Type: Boolean | ||
Values: `true` | `false` | ||
Default: `true` | ||
|
||
### allowFutureDates | ||
### allowFutureDates - iOS | ||
Shows or hide dates after selected date. | ||
|
||
Typ: `Boolean` | ||
|
||
Values: `true` / `false` | ||
|
||
Type: Boolean | ||
Values: `true` | `false` | ||
Default: `true` | ||
|
||
### minDate (new) | ||
Minimum date. | ||
|
||
Typ: `Date` or empty `String` | ||
|
||
Default: `''` (empty String) | ||
|
||
### maxDate (new) | ||
Maximum date. | ||
|
||
Typ: `Date` or empty `String` | ||
|
||
Default: `''` (empty String) | ||
|
||
### doneButtonLabel (new) | ||
### doneButtonLabel - iOS | ||
Label of done button. | ||
Typ: String | ||
Default: `Done` | ||
|
||
Typ: `String` | ||
|
||
Default: `'Done'` | ||
|
||
### doneButtonColor (new) | ||
### doneButtonColor - iOS | ||
Hex color of done button. | ||
Typ: String | ||
Default: `#0000FF` | ||
|
||
Typ: `String` | ||
|
||
Default: `'#0000FF'` | ||
|
||
### cancelButtonLabel (new) | ||
### cancelButtonLabel - iOS | ||
Label of cancel button. | ||
Type: String | ||
Default: `Cancel` | ||
|
||
Typ: `String` | ||
|
||
Default: `'Cancel'` | ||
|
||
### cancelButtonColor (new) | ||
### cancelButtonColor - iOS | ||
Hex color of cancel button. | ||
Type: String | ||
Default: `#000000` | ||
|
||
Typ: `String` | ||
|
||
Default: `'#000000'` | ||
|
||
### x (new) | ||
X position of date picker (iPad only). The position is absolute to the root view of the application. | ||
### x - iOS (iPad only) | ||
X position of date picker. The position is absolute to the root view of the application. | ||
Type: String | ||
Default: `0` | ||
|
||
Typ: `String` | ||
|
||
Default: `'0'` | ||
|
||
### y (new) | ||
Y position of date picker (iPad only). The position is absolute to the root view of the application. | ||
|
||
Typ: `String` | ||
|
||
Default: `'0'` | ||
### y - iOS (iPad only) | ||
Y position of date picker. The position is absolute to the root view of the application. | ||
Type: String | ||
Default: `0` | ||
|
||
## Requirements | ||
- PhoneGap 3.0 or newer /Cordova 3.0 or newer | ||
- iOS 5 or newer | ||
|
||
## Author of migration to PhoneGap 3.0 | ||
Jens Krause // [WEBSECTOR.DE](http://www.websector.de) | ||
- PhoneGap 3.0 or newer / Cordova 3.0 or newer | ||
- Android 2.3.1 or newer / iOS 5 or newer |