From d0c14c9c19c4308d9ee4df9ec55675a80a36a13b Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Sat, 14 Nov 2015 16:04:39 +0100 Subject: [PATCH 1/4] Add definitions for ngCordova datepicker plugin --- ng-cordova/datepicker.d.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 ng-cordova/datepicker.d.ts diff --git a/ng-cordova/datepicker.d.ts b/ng-cordova/datepicker.d.ts new file mode 100644 index 000000000..1a976be65 --- /dev/null +++ b/ng-cordova/datepicker.d.ts @@ -0,0 +1,38 @@ +// Type definitions for ngCordova datepicker plugin +// Project: https://github.com/VitaliiBlagodir/cordova-plugin-datepicker +// Definitions by: Jacques Kang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module ngCordova { + + export interface DatePickerOptions { + mode?: string; + date?: Date | string; + minDate?: Date | string; + maxDate?: Date | string; + titleText?: string; + okText?: string; + cancelText?: string; + todayText?: string; + nowText?: string; + is24Hour?: boolean; + androidTheme?: number; + allowOldDates?: boolean; + allowFutureDates?: boolean; + doneButtonLabel?: string; + doneButtonColor?: string; + cancelButtonLabel?: string; + cancelButtonColor?: string; + x?: number; + y?: number; + minuteInterval?: number; + popoverArrowDirection?: string; + locale?: string; + } + + export interface IDatePickerService { + show(options?: DatePickerOptions): ng.IPromise; + } +} \ No newline at end of file From 0efdfccb3300c0e9b7c1cfabb5d52685fc8ee8f1 Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Sat, 14 Nov 2015 16:09:19 +0100 Subject: [PATCH 2/4] Update datepicker.d.ts --- ng-cordova/datepicker.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ng-cordova/datepicker.d.ts b/ng-cordova/datepicker.d.ts index 1a976be65..f8da22454 100644 --- a/ng-cordova/datepicker.d.ts +++ b/ng-cordova/datepicker.d.ts @@ -35,4 +35,4 @@ declare module ngCordova { export interface IDatePickerService { show(options?: DatePickerOptions): ng.IPromise; } -} \ No newline at end of file +} From 5d27a1bc8254435f4d9f7b9577426a9f3e0f6b7c Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Sat, 14 Nov 2015 16:45:26 +0100 Subject: [PATCH 3/4] Revert "Add definitions for ngCordova datepicker plugin" This reverts commit d0c14c9c19c4308d9ee4df9ec55675a80a36a13b. --- ng-cordova/datepicker.d.ts | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 ng-cordova/datepicker.d.ts diff --git a/ng-cordova/datepicker.d.ts b/ng-cordova/datepicker.d.ts deleted file mode 100644 index 1a976be65..000000000 --- a/ng-cordova/datepicker.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Type definitions for ngCordova datepicker plugin -// Project: https://github.com/VitaliiBlagodir/cordova-plugin-datepicker -// Definitions by: Jacques Kang -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare module ngCordova { - - export interface DatePickerOptions { - mode?: string; - date?: Date | string; - minDate?: Date | string; - maxDate?: Date | string; - titleText?: string; - okText?: string; - cancelText?: string; - todayText?: string; - nowText?: string; - is24Hour?: boolean; - androidTheme?: number; - allowOldDates?: boolean; - allowFutureDates?: boolean; - doneButtonLabel?: string; - doneButtonColor?: string; - cancelButtonLabel?: string; - cancelButtonColor?: string; - x?: number; - y?: number; - minuteInterval?: number; - popoverArrowDirection?: string; - locale?: string; - } - - export interface IDatePickerService { - show(options?: DatePickerOptions): ng.IPromise; - } -} \ No newline at end of file From 4fdf16607c935c5b75b3adc2dc21b359d67962f1 Mon Sep 17 00:00:00 2001 From: Jacques Kang Date: Sat, 14 Nov 2015 16:50:28 +0100 Subject: [PATCH 4/4] add definitions for ng-cordova datepicker plugin --- ng-cordova/datepicker-tests.ts | 31 +++++++++++++++++++++++ ng-cordova/datepicker.d.ts | 46 ++++++++++++++++++++++++++++++++++ ng-cordova/tsd.d.ts | 1 + 3 files changed, 78 insertions(+) create mode 100644 ng-cordova/datepicker-tests.ts create mode 100644 ng-cordova/datepicker.d.ts diff --git a/ng-cordova/datepicker-tests.ts b/ng-cordova/datepicker-tests.ts new file mode 100644 index 000000000..340b9fff0 --- /dev/null +++ b/ng-cordova/datepicker-tests.ts @@ -0,0 +1,31 @@ +/// +/// + +module ngCordova { + function smoketest($cordovaDatePicker: IDatePickerService, isIos: boolean) { + + // minDate is a Date object for iOS and a millisecond precision unix timestamp + // for Android, so you need to account for that when using the plugin. Also, + // on Android, only the date is enforced (time is not). + // - from https://github.com/VitaliiBlagodir/cordova-plugin-datepicker + var minDate = isIos ? new Date() : (new Date()).valueOf(); + + var options: DatePickerOptions = { + date: new Date(), + mode: 'date', + minDate: minDate, + maxDate: '', + allowOldDates: true, + allowFutureDates: false, + doneButtonLabel: 'DONE', + doneButtonColor: '#F2F3F4', + cancelButtonLabel: 'CANCEL', + cancelButtonColor: '#000000', + androidTheme: AndroidTheme.HoloDark + }; + + $cordovaDatePicker.show(options).then(function(date) { + alert(date); + }); + }; +} diff --git a/ng-cordova/datepicker.d.ts b/ng-cordova/datepicker.d.ts new file mode 100644 index 000000000..b4b195982 --- /dev/null +++ b/ng-cordova/datepicker.d.ts @@ -0,0 +1,46 @@ +// Type definitions for ngCordova datepicker plugin +// Project: https://github.com/VitaliiBlagodir/cordova-plugin-datepicker +// Definitions by: Jacques Kang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module ngCordova { + + export enum AndroidTheme { + Traditional = 1, + HoloDark = 2, + HoloLight = 3, + DeviceDefaultDark = 4, + DeviceDefaultLight = 5 + } + + export interface DatePickerOptions { + mode?: string; + date?: Date | string | number; + minDate?: Date | string | number; + maxDate?: Date | string | number; + titleText?: string; + okText?: string; + cancelText?: string; + todayText?: string; + nowText?: string; + is24Hour?: boolean; + androidTheme?: AndroidTheme; + allowOldDates?: boolean; + allowFutureDates?: boolean; + doneButtonLabel?: string; + doneButtonColor?: string; + cancelButtonLabel?: string; + cancelButtonColor?: string; + x?: number; + y?: number; + minuteInterval?: number; + popoverArrowDirection?: string; + locale?: string; + } + + export interface IDatePickerService { + show(options?: DatePickerOptions): ng.IPromise; + } +} diff --git a/ng-cordova/tsd.d.ts b/ng-cordova/tsd.d.ts index 188cb367d..899452ad8 100644 --- a/ng-cordova/tsd.d.ts +++ b/ng-cordova/tsd.d.ts @@ -12,3 +12,4 @@ /// /// /// +///