From eeaeeb6b39edec021f37db5790b841055a05aa48 Mon Sep 17 00:00:00 2001 From: Leonardo Gatica Date: Wed, 3 Jul 2019 15:17:54 -0400 Subject: [PATCH] feat(typings): add FormatTimeZoneOptions extended of FormatOptions (#6) Set FormatTimeZoneOptions in formatToTimeZone --- src/formatToTimeZone.d.ts | 7 +++++-- src/index.d.ts | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/formatToTimeZone.d.ts b/src/formatToTimeZone.d.ts index 5c16ebc..07422e7 100644 --- a/src/formatToTimeZone.d.ts +++ b/src/formatToTimeZone.d.ts @@ -1,8 +1,11 @@ type DateInput = string | number | Date -interface TimeZoneOptions { +interface FormatOptions { + locale?: Object +} +interface FormatTimeZoneOptions extends FormatOptions { timeZone: string } -declare function formatToTimeZone (dateInput: DateInput, format: string, options: TimeZoneOptions): string +declare function formatToTimeZone (dateInput: DateInput, format: string, options: FormatTimeZoneOptions): string export { formatToTimeZone } diff --git a/src/index.d.ts b/src/index.d.ts index 587b2db..f58965c 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -2,6 +2,12 @@ type DateInput = string | number | Date interface TimeZoneOptions { timeZone: string } +interface FormatOptions { + locale?: Object +} +interface FormatTimeZoneOptions extends FormatOptions { + timeZone: string +} declare function convertToLocalTime (dateInput: DateInput, options: TimeZoneOptions): Date declare function convertToTimeZone (dateInput: DateInput, options: TimeZoneOptions): Date @@ -10,7 +16,7 @@ declare function parseFromString (dateString: string, format: string): Date declare function parseFromTimeZone (dateString: string, format: string, options: TimeZoneOptions): Date declare function parseFromTimeZone (dateString: string, options: TimeZoneOptions): Date -declare function formatToTimeZone (dateInput: DateInput, format: string, options: TimeZoneOptions): string +declare function formatToTimeZone (dateInput: DateInput, format: string, options: FormatTimeZoneOptions): string export { convertToLocalTime, convertToTimeZone, parseFromString, parseFromTimeZone, formatToTimeZone