Skip to content

Commit 88bb172

Browse files
authored
fix(use-i18n): optional options type on formatDate (#545)
1 parent a958bf2 commit 88bb172

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/use-i18n/src/usei18n.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ interface Context {
5959
currentLocale: string
6060
dateFnsLocale?: Locale,
6161
datetime: (date: Date | number, options?: Intl.DateTimeFormatOptions) => string,
62-
formatDate: (value: Date | number | string, options: FormatDateOptions) => string,
62+
formatDate: (value: Date | number | string, options?: FormatDateOptions) => string,
6363
formatList: (listFormat: string[], options?: IntlListFormatOptions) => string,
6464
formatNumber: (numb: number, options?: Intl.NumberFormatOptions) => string,
6565
formatUnit: (value: number, options: FormatUnitOptions) => string,
@@ -229,7 +229,7 @@ const I18nContextProvider = ({
229229
)
230230

231231
const formatDate = useCallback(
232-
(value: Date | number | string, options: FormatDateOptions) =>
232+
(value: Date | number | string, options: FormatDateOptions = 'short') =>
233233
dateFormat(currentLocale, value, options),
234234
[currentLocale],
235235
)

0 commit comments

Comments
 (0)