From ca1b41d823a17c0f836a9ed4a3872f76030ecf85 Mon Sep 17 00:00:00 2001 From: wagich Date: Tue, 27 Jun 2017 19:14:12 +0200 Subject: [PATCH 1/2] Adds localization to flatpickr --- types/flatpickr/index.d.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/types/flatpickr/index.d.ts b/types/flatpickr/index.d.ts index 535ec0145e..57c3d60213 100644 --- a/types/flatpickr/index.d.ts +++ b/types/flatpickr/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chmln/flatpickr // Definitions by: James Birtles // Rowell Heria +// Michael Wagner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare function flatpickr(element: string | Element | HTMLElement, options?: Flatpickr.Options): Flatpickr; @@ -21,6 +22,11 @@ declare class Flatpickr { set(option: string, value: any): void; setDate(date: Flatpickr.DateString | Flatpickr.DateString[], triggerChange?: boolean, dateFormat?: string): void; toggle(): void; + + static localize(locale: string | Flatpickr.Locale): void; + static l10ns: { + default: Flatpickr.Locale; + } } declare namespace Flatpickr { @@ -63,8 +69,32 @@ declare namespace Flatpickr { utc?: boolean; weekNumbers?: boolean; wrap?: boolean; + locale?: string | Locale; } - + + interface Locale { + weekdays?: { + shorthand?: string[]; + longhand?: string[]; + }; + + months?: { + shorthand?: string[]; + longhand?: string[]; + }; + + firstDayOfWeek?: number; + weekAbbreviation?: string; + rangeSeparator?: string; + am?: string; + pm?: string; + + ordinal?: ((nth: number) => string) | string; + + scrollTitle?: string; + toggleTitle?: string; + } + type DateString = Date | string; type DateRange = DateString | { from: DateString, to: DateString } | ((date: Date) => boolean); type Mode = 'single' | 'multiple' | 'range'; From 1cce847cfeab6475e9e602557b5eeb30ea867657 Mon Sep 17 00:00:00 2001 From: wagich Date: Tue, 27 Jun 2017 19:30:00 +0200 Subject: [PATCH 2/2] tries to make travis happy --- types/flatpickr/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/flatpickr/index.d.ts b/types/flatpickr/index.d.ts index 57c3d60213..fce4214c90 100644 --- a/types/flatpickr/index.d.ts +++ b/types/flatpickr/index.d.ts @@ -22,11 +22,11 @@ declare class Flatpickr { set(option: string, value: any): void; setDate(date: Flatpickr.DateString | Flatpickr.DateString[], triggerChange?: boolean, dateFormat?: string): void; toggle(): void; - + static localize(locale: string | Flatpickr.Locale): void; static l10ns: { default: Flatpickr.Locale; - } + }; } declare namespace Flatpickr { @@ -71,30 +71,30 @@ declare namespace Flatpickr { wrap?: boolean; locale?: string | Locale; } - + interface Locale { weekdays?: { shorthand?: string[]; longhand?: string[]; }; - + months?: { shorthand?: string[]; longhand?: string[]; }; - + firstDayOfWeek?: number; weekAbbreviation?: string; rangeSeparator?: string; am?: string; pm?: string; - + ordinal?: ((nth: number) => string) | string; - + scrollTitle?: string; toggleTitle?: string; - } - + } + type DateString = Date | string; type DateRange = DateString | { from: DateString, to: DateString } | ((date: Date) => boolean); type Mode = 'single' | 'multiple' | 'range';