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 @@ /// /// /// +///