diff --git a/examples/bpk-component-calendar/examples.js b/examples/bpk-component-calendar/examples.js index da30eb94ec..1c55d81248 100644 --- a/examples/bpk-component-calendar/examples.js +++ b/examples/bpk-component-calendar/examples.js @@ -249,14 +249,42 @@ const WeekExample = () => { DateComponent: DummyDateComponent, dateModifiers: {}, dates: [ - new Date(1980, 5, 10), - new Date(1980, 5, 11), - new Date(1980, 5, 12), - new Date(1980, 5, 13), - new Date(1980, 5, 14), - new Date(1980, 5, 15), - new Date(1980, 5, 16), - ].map(startOfDay), + { + val: startOfDay(new Date(1980, 5, 10)), + customLabel: 'Saturday, 10 May 1980', + isoLabel: '1980-05-10', + }, + { + val: startOfDay(new Date(1980, 5, 11)), + customLabel: 'Sunday, 11 May 1980', + isoLabel: '1980-05-11', + }, + { + val: startOfDay(new Date(1980, 5, 12)), + customLabel: 'Monday, 12 May 1980', + isoLabel: '1980-05-12', + }, + { + val: startOfDay(new Date(1980, 5, 13)), + customLabel: 'Tuesday, 13 May 1980', + isoLabel: '1980-05-13', + }, + { + val: startOfDay(new Date(1980, 5, 14)), + customLabel: 'Wednesday, 14 May 1980', + isoLabel: '1980-05-14', + }, + { + val: startOfDay(new Date(1980, 5, 15)), + customLabel: 'Thursday, 15 May 1980', + isoLabel: '1980-05-15', + }, + { + val: startOfDay(new Date(1980, 5, 16)), + customLabel: 'Friday, 16 May 1980', + isoLabel: '1980-05-16', + }, + ], daysOfWeek: weekDays, formatDateFull: (d) => d.toString(), preventKeyboardFocus: false, diff --git a/packages/bpk-component-calendar/src/BpkCalendarDate.tsx b/packages/bpk-component-calendar/src/BpkCalendarDate.tsx index c16d5c8c4c..3a0b70033e 100644 --- a/packages/bpk-component-calendar/src/BpkCalendarDate.tsx +++ b/packages/bpk-component-calendar/src/BpkCalendarDate.tsx @@ -52,6 +52,7 @@ export type Props = DefaultProps & { type DefaultProps = { className?: string | null; + isoLabel?: string; isBlocked?: boolean; isFocused?: boolean; isKeyboardFocusable?: boolean; @@ -185,6 +186,7 @@ class BpkCalendarDate extends PureComponent { } delete buttonProps.preventKeyboardFocus; + delete buttonProps.isoLabel; return (