2016-02-16 06:22:50 +08:00
|
|
|
import {Plugin, Cordova} from './plugin';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The DatePicker plugin allows the user to fetch date or time using native dialogs.
|
|
|
|
*
|
|
|
|
* Platforms supported: iOS, Android, Windows
|
|
|
|
*
|
2016-03-06 22:56:31 +08:00
|
|
|
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [Datepicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
|
2016-02-16 06:22:50 +08:00
|
|
|
*
|
|
|
|
* Install the plugin by running the following command:
|
|
|
|
* ```shell
|
|
|
|
* ionic plugin add cordova-plugin-datepicker
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @usage
|
|
|
|
* ```js
|
|
|
|
* DatePicker.
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
@Plugin({
|
2016-02-17 15:23:56 +08:00
|
|
|
plugin: 'cordova-plugin-datepicker',
|
|
|
|
pluginRef: 'plugins.datePicker'
|
2016-02-16 06:22:50 +08:00
|
|
|
})
|
|
|
|
export class DatePicker {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the date and/or time picker dialog(s)
|
|
|
|
* @param options
|
|
|
|
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
|
|
|
|
*/
|
2016-03-05 05:42:21 +08:00
|
|
|
@Cordova()
|
2016-03-06 22:56:31 +08:00
|
|
|
static show(options?: {
|
|
|
|
mode?: string,
|
2016-03-06 23:01:37 +08:00
|
|
|
date?: Date,
|
|
|
|
minDate?: Date,
|
|
|
|
maxDate?: Date,
|
2016-03-06 22:56:31 +08:00
|
|
|
titleText?: string,
|
|
|
|
okText?: string,
|
|
|
|
cancelText?: string,
|
|
|
|
todayText?: string,
|
|
|
|
nowText?: string,
|
|
|
|
is24Hour?: boolean,
|
|
|
|
androidTheme?: number,
|
|
|
|
allowOldDate?: boolean,
|
|
|
|
allowFutureDates?: boolean,
|
|
|
|
doneButtonLabel?: string,
|
|
|
|
doneButtonColor?: string,
|
|
|
|
cancelButtonLabel?: string,
|
|
|
|
cancelButtonColor?: string,
|
2016-03-06 23:01:37 +08:00
|
|
|
x?: number,
|
|
|
|
y?: number,
|
2016-03-06 22:56:31 +08:00
|
|
|
minuteInterval?: number,
|
|
|
|
popoverArrowDirection?: string,
|
|
|
|
locale?: string
|
|
|
|
}): Promise<Date> {
|
2016-02-16 06:22:50 +08:00
|
|
|
return new Promise<Date>((res, rej) => {});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|