Skip to content

Commit 04cf9f1

Browse files
committed
Fix TypeError: get format called on incompatible undefined
Related to wojtekmaj/react-datetime-picker#452
1 parent 014a293 commit 04cf9f1

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/react-date-picker/src/shared/dateFormatter.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ export function getFormatter(
1515
const formatterCacheLocale = formatterCache.get(localeWithDefault);
1616

1717
if (!formatterCacheLocale.has(options)) {
18-
formatterCacheLocale.set(
19-
options,
20-
new Intl.DateTimeFormat(localeWithDefault || undefined, options).format,
21-
);
18+
const formatter = new Intl.DateTimeFormat(localeWithDefault || undefined, options);
19+
20+
formatterCacheLocale.set(options, formatter.format.bind(formatter));
2221
}
2322

2423
return formatterCacheLocale.get(options)(date);

0 commit comments

Comments
 (0)