Skip to content

Commit

Permalink
feat: Use overloads for relativeTime
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Feb 3, 2025
1 parent 77949ef commit bae1131
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/use-intl/src/core/createFormatter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,15 @@ export default function createFormatter(props: Props) {
/** The date time that needs to be formatted. */
date: number | Date,
/** The reference point in time to which `date` will be formatted in relation to. If this value is absent, a globally configured `now` value or alternatively the current time will be used. */
now?: RelativeTimeFormatOptions['now']
): string;
function relativeTime(
/** The date time that needs to be formatted. */
date: number | Date,
options?: RelativeTimeFormatOptions
): string;
function relativeTime(
date: number | Date,
nowOrOptions?: RelativeTimeFormatOptions['now'] | RelativeTimeFormatOptions
) {
try {
Expand Down

0 comments on commit bae1131

Please sign in to comment.