UNPKG

3.8 kBTypeScriptView Raw
1export interface DatePickerOptions {
2 /**
3 * The mode of the date picker
4 * Values: date | time | datetime
5 */
6 mode: string;
7 /**
8 * Selected date
9 */
10 date: Date | string | number;
11 /**
12 * Minimum date
13 * Default: empty String
14 */
15 minDate?: Date | string | number;
16 /**
17 * Maximum date
18 * Default?: empty String
19 */
20 maxDate?: Date | string | number;
21 /**
22 * Label for the dialog title. If empty, uses android default (Set date/Set time).
23 * Default?: empty String
24 */
25 titleText?: string;
26 /**
27 * Label of BUTTON_POSITIVE (done button) on Android
28 */
29 okText?: string;
30 /**
31 * Label of BUTTON_NEGATIVE (cancel button). If empty, uses android.R.string.cancel.
32 */
33 cancelText?: string;
34 /**
35 * Label of today button. If empty, doesn't show the option to select current date.
36 */
37 todayText?: string;
38 /**
39 * Label of now button. If empty, doesn't show the option to select current time.
40 */
41 nowText?: string;
42 /**
43 * Shows time dialog in 24 hours format.
44 */
45 is24Hour?: boolean;
46 /**
47 * Choose the Android theme for the picker. You can use the DatePicker.ANDROID_THEMES property.
48 * Values: 1: THEME_TRADITIONAL | 2: THEME_HOLO_DARK | 3: THEME_HOLO_LIGHT | 4: THEME_DEVICE_DEFAULT_DARK | 5: THEME_DEVICE_DEFAULT_LIGHT
49 */
50 androidTheme?: number;
51 /**
52 * Shows or hide dates earlier then selected date.
53 */
54 allowOldDates?: boolean;
55 /**
56 * Shows or hide dates after selected date.
57 */
58 allowFutureDates?: boolean;
59 /**
60 * Label of done button.
61 */
62 doneButtonLabel?: string;
63 /**
64 * Hex color of done button.
65 */
66 doneButtonColor?: string;
67 /**
68 * Label of cancel button.
69 */
70 cancelButtonLabel?: string;
71 /**
72 * Hex color of cancel button.
73 */
74 cancelButtonColor?: string;
75 /**
76 * X position of date picker. The position is absolute to the root view of the application.
77 */
78 x?: number;
79 /**
80 * Y position of date picker. The position is absolute to the root view of the application.
81 */
82 y?: number;
83 /**
84 * Interval between options in the minute section of the date picker.
85 */
86 minuteInterval?: number;
87 /**
88 * Force the UIPopoverArrowDirection enum. The value any will revert to default UIPopoverArrowDirectionAny and let the app choose the proper direction itself.
89 */
90 popoverArrowDirection?: string;
91 /**
92 * Force locale for datePicker.
93 */
94 locale?: string;
95}
96/**
97 * @name Date Picker
98 * @description
99 * The DatePicker plugin allows the user to fetch date or time using native dialogs.
100 *
101 * @usage
102 * ```typescript
103 * import { DatePicker } from 'ionic-native';
104 *
105 *
106 * DatePicker.show({
107 * date: new Date(),
108 * mode: 'date'
109 * }).then(
110 * date => console.log('Got date: ', date),
111 * err => console.log('Error occurred while getting date: ', err)
112 * );
113 * ```
114 * @interfaces
115 * DatePickerOptions
116 */
117export declare class DatePicker {
118 /**
119 * @private
120 */
121 static ANDROID_THEMES: {
122 THEME_TRADITIONAL: number;
123 THEME_HOLO_DARK: number;
124 THEME_HOLO_LIGHT: number;
125 THEME_DEVICE_DEFAULT_DARK: number;
126 THEME_DEVICE_DEFAULT_LIGHT: number;
127 };
128 /**
129 * Shows the date and/or time picker dialog(s)
130 * @param {DatePickerOptions} options Options for the date picker.
131 * @returns {Promise<Date>} Returns a promise that resolves with the picked date and/or time, or rejects with an error.
132 */
133 static show(options: DatePickerOptions): Promise<Date>;
134}