107 lines
2.5 KiB
TypeScript
Raw Normal View History

2016-07-08 00:50:03 +02:00
import { Cordova, Plugin } from './plugin';
2016-02-15 17:22:50 -05:00
export interface DatePickerOptions {
/**
* Platforms: iOS, Android, Windows
* The mode of the date picker
* Values: date | time | datetime
*/
mode: string;
/**
* Platforms: iOS, Android, Windows
* Selected date
*/
date: Date | string | number;
/**
* Platforms: iOS, Android, Windows
* Minimum date
* Type: Date | empty String
* Default: empty String
*/
minDate?: Date | string | number;
/**
2016-03-13 20:35:47 -04:00
* Platforms?: iOS, Android, Windows
* Maximum date
2016-03-13 20:35:47 -04:00
* Type?: Date | empty String
* Default?: empty String
*/
maxDate?: Date | string | number;
/**
2016-03-13 20:35:47 -04:00
* Platforms?: Android
* Label for the dialog title. If empty, uses android default (Set date/Set time).
2016-03-13 20:35:47 -04:00
* Type?: String
* Default?: empty String
*/
titleText?: string;
/**
2016-03-13 20:35:47 -04:00
* Platforms?: Android
* Label of BUTTON_POSITIVE (done button) on Android
*/
okText?: string;
// TODO complete documentation here, and copy params & docs to main plugin docs
cancelText?: string;
todayText?: string;
nowText?: string;
is24Hour?: boolean;
androidTheme?: number;
allowOldDate?: boolean;
allowFutureDates?: boolean;
doneButtonLabel?: string;
doneButtonColor?: string;
cancelButtonLabel?: string;
cancelButtonColor?: string;
x?: number;
y?: number;
minuteInterval?: number;
popoverArrowDirection?: string;
locale?: string;
}
2016-02-15 17:22:50 -05:00
/**
2016-03-13 15:45:07 -04:00
* @name Date Picker
* @description
2016-02-15 17:22:50 -05:00
* The DatePicker plugin allows the user to fetch date or time using native dialogs.
*
* Platforms supported: iOS, Android, Windows
*
* Requires Cordova plugin: `cordova-plugin-datepicker`. For more info, please see the [DatePicker plugin docs](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker).
2016-02-15 17:22:50 -05:00
*
* @usage
* ```typescript
* import { DatePicker } from 'ionic-native';
*
*
* DatePicker.show({
* date: new Date(),
* mode: 'date'
* }).then(
* date => console.log('Got date: ', date),
* err => console.log('Error occurred while getting date: ', err)
* );
2016-02-15 17:22:50 -05:00
* ```
*
*/
@Plugin({
plugin: 'cordova-plugin-datepicker',
2016-03-12 19:08:47 -05:00
pluginRef: 'datePicker',
repo: 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker'
2016-02-15 17:22:50 -05:00
})
export class DatePicker {
/**
* Shows the date and/or time picker dialog(s)
2016-07-08 15:19:13 -04:00
* @param {DatePickerOptions} options Options for the date picker.
2016-02-15 17:22:50 -05:00
* @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
*/
2016-03-04 15:42:21 -06:00
@Cordova()
static show(options: DatePickerOptions): Promise<Date> { return; }
2016-02-15 17:22:50 -05:00
2016-07-08 00:50:03 +02:00
}