From ee5a4ec41edddfb57d103c35182dc635c9264a10 Mon Sep 17 00:00:00 2001 From: Xibo Wang Date: Wed, 14 Oct 2020 13:48:13 +1100 Subject: [PATCH] fix: update localeData plugin type (#1116) --- types/plugin/localeData.d.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/types/plugin/localeData.d.ts b/types/plugin/localeData.d.ts index 7d981763..6b0c11c0 100644 --- a/types/plugin/localeData.d.ts +++ b/types/plugin/localeData.d.ts @@ -4,7 +4,37 @@ declare const plugin: PluginFunc export = plugin declare module 'dayjs' { + type WeekdayNames = [string, string, string, string, string, string, string]; + type MonthNames = [string, string, string, string, string, string, string, string, string, string, string, string]; + + interface InstanceLocaleDataReturn { + firstDayOfWeek(): number; + weekdays(instance?: Dayjs): WeekdayNames; + weekdaysShort(instance?: Dayjs): WeekdayNames; + weekdaysMin(instance?: Dayjs): WeekdayNames; + months(instance?: Dayjs): MonthNames; + monthsShort(instance?: Dayjs): MonthNames; + longDateFormat(format: string): string; + } + + interface GlobalLocaleDataReturn { + firstDayOfWeek(): number; + weekdays(): WeekdayNames; + weekdaysShort(): WeekdayNames; + weekdaysMin(): WeekdayNames; + months(): MonthNames; + monthsShort(): MonthNames; + longDateFormat(format: string): string; + } + interface Dayjs { - localeData(): any + localeData(): InstanceLocaleDataReturn; } + + export function weekdays(localOrder?: boolean): WeekdayNames; + export function weekdaysShort(localOrder?: boolean): WeekdayNames; + export function weekdaysMin(localOrder?: boolean): WeekdayNames; + export function monthsShort(): MonthNames; + export function months(): MonthNames; + export function localeData(): GlobalLocaleDataReturn; }