diff --git a/packages/bpk-component-calendar/src/BpkCalendarGrid.tsx b/packages/bpk-component-calendar/src/BpkCalendarGrid.tsx index 60808f2982..77085f5319 100644 --- a/packages/bpk-component-calendar/src/BpkCalendarGrid.tsx +++ b/packages/bpk-component-calendar/src/BpkCalendarGrid.tsx @@ -30,6 +30,7 @@ import { getCalendarMonthWeeks, isSameMonth, } from './date-utils'; +import { memoize } from './utils'; import type { DateModifiers, SelectionConfiguration } from './custom-proptypes'; @@ -170,7 +171,7 @@ class BpkCalendarGrid extends Component { dates={dates} onDateClick={onDateClick} onDateKeyDown={onDateKeyDown} - formatDateFull={formatDateFull} + formatDateFull={memoize(formatDateFull)} DateComponent={DateComponent} dateModifiers={dateModifiers!} preventKeyboardFocus={preventKeyboardFocus} diff --git a/packages/bpk-component-calendar/src/composeCalendar.tsx b/packages/bpk-component-calendar/src/composeCalendar.tsx index ec2bfc10c7..178f3e618b 100644 --- a/packages/bpk-component-calendar/src/composeCalendar.tsx +++ b/packages/bpk-component-calendar/src/composeCalendar.tsx @@ -21,6 +21,7 @@ import type { ComponentType } from 'react'; import { cssModules } from '../../bpk-react-utils'; import { CALENDAR_SELECTION_TYPE } from './custom-proptypes'; +import { memoize } from './utils'; import type { DaysOfWeek, @@ -184,7 +185,7 @@ const composeCalendar = ( {Nav && (