Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing locale type definition for formatDuration #1881

Merged
merged 2 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/formatDuration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const defaultFormat = [
* @param {string[]} [options.format=['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds']] - the array of units to format
* @param {boolean} [options.zero=false] - should be zeros be included in the output?
* @param {string} [options.delimiter=' '] - delimiter string
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
* @returns {string} the formatted date string
* @throws {TypeError} 1 argument required
*
Expand Down
3 changes: 2 additions & 1 deletion src/formatDuration/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ declare module.exports: (
options?: {
format?: string[],
zero?: boolean,
delimiter?: string
delimiter?: string,
locale?: Locale
}
) => string
1 change: 1 addition & 0 deletions src/fp/formatDurationWithOptions/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type CurriedFn2<A, B, R> = <A>(

declare module.exports: CurriedFn2<
{
locale?: Locale,
delimiter?: string,
zero?: boolean,
format?: string[]
Expand Down
1 change: 1 addition & 0 deletions src/fp/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ declare module.exports: {
formatDuration: CurriedFn1<Duration, string>,
formatDurationWithOptions: CurriedFn2<
{
locale?: Locale,
delimiter?: string,
zero?: boolean,
format?: string[]
Expand Down
3 changes: 2 additions & 1 deletion src/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ declare module.exports: {
options?: {
format?: string[],
zero?: boolean,
delimiter?: string
delimiter?: string,
locale?: Locale
}
) => string,

Expand Down
5 changes: 5 additions & 0 deletions typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ declare module 'date-fns' {
format?: string[]
zero?: boolean
delimiter?: string
locale?: Locale
}
): string
namespace formatDuration {}
Expand Down Expand Up @@ -4264,6 +4265,7 @@ declare module 'date-fns/fp' {

const formatDurationWithOptions: CurriedFn2<
{
locale?: Locale
delimiter?: string
zero?: boolean
format?: string[]
Expand Down Expand Up @@ -8297,6 +8299,7 @@ declare module 'date-fns/esm' {
format?: string[]
zero?: boolean
delimiter?: string
locale?: Locale
}
): string
namespace formatDuration {}
Expand Down Expand Up @@ -12136,6 +12139,7 @@ declare module 'date-fns/esm/fp' {

const formatDurationWithOptions: CurriedFn2<
{
locale?: Locale
delimiter?: string
zero?: boolean
format?: string[]
Expand Down Expand Up @@ -18823,6 +18827,7 @@ interface dateFns {
format?: string[]
zero?: boolean
delimiter?: string
locale?: Locale
}
): string

Expand Down