From 11bf30db34c19ec913813ed1ff0779db032c5063 Mon Sep 17 00:00:00 2001 From: Emmanuel Chambon Date: Thu, 16 Dec 2021 15:05:09 +0100 Subject: [PATCH] fix(use-i18n): optional options type on formatDate --- packages/use-i18n/src/usei18n.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/use-i18n/src/usei18n.tsx b/packages/use-i18n/src/usei18n.tsx index 222ede069..e7d45c883 100644 --- a/packages/use-i18n/src/usei18n.tsx +++ b/packages/use-i18n/src/usei18n.tsx @@ -59,7 +59,7 @@ interface Context { currentLocale: string dateFnsLocale?: Locale, datetime: (date: Date | number, options?: Intl.DateTimeFormatOptions) => string, - formatDate: (value: Date | number | string, options: FormatDateOptions) => string, + formatDate: (value: Date | number | string, options?: FormatDateOptions) => string, formatList: (listFormat: string[], options?: IntlListFormatOptions) => string, formatNumber: (numb: number, options?: Intl.NumberFormatOptions) => string, formatUnit: (value: number, options: FormatUnitOptions) => string, @@ -229,7 +229,7 @@ const I18nContextProvider = ({ ) const formatDate = useCallback( - (value: Date | number | string, options: FormatDateOptions) => + (value: Date | number | string, options: FormatDateOptions = 'short') => dateFormat(currentLocale, value, options), [currentLocale], )