File tree Expand file tree Collapse file tree
packages/react-datetime-picker/src/shared Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) ;
@@ -40,10 +39,9 @@ export function getNumberFormatter(
4039 const numberFormatterCacheLocale = numberFormatterCache . get ( localeWithDefault ) ;
4140
4241 if ( ! numberFormatterCacheLocale . has ( options ) ) {
43- numberFormatterCacheLocale . set (
44- options ,
45- new Intl . NumberFormat ( localeWithDefault || undefined , options ) . format ,
46- ) ;
42+ const formatter = new Intl . NumberFormat ( localeWithDefault || undefined , options ) ;
43+
44+ numberFormatterCacheLocale . set ( options , formatter . format . bind ( formatter ) ) ;
4745 }
4846
4947 return numberFormatterCacheLocale . get ( options ) ( number ) ;
You can’t perform that action at this time.
0 commit comments