Skip to content

Commit

Permalink
feat(typings): add FormatTimeZoneOptions extended of FormatOptions (#6)
Browse files Browse the repository at this point in the history
Set FormatTimeZoneOptions in formatToTimeZone
  • Loading branch information
lgaticaq authored and prantlf committed Jul 3, 2019
1 parent 260fc26 commit eeaeeb6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/formatToTimeZone.d.ts
Original file line number Diff line number Diff line change
@@ -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 }
8 changes: 7 additions & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit eeaeeb6

Please sign in to comment.