Skip to content

Commit e150f96

Browse files
[WC-1293]: Calendar event date visibility (#1630)
2 parents f873306 + 19054d2 commit e150f96

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

packages/pluggableWidgets/calendar-web/src/Calendar.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@
8383
<caption>Enable create</caption>
8484
<description />
8585
</property>
86+
<property key="showEventDate" type="boolean" defaultValue="true">
87+
<caption>Show event date range</caption>
88+
<description>Show the start and end date of the event</description>
89+
</property>
8690
<property key="defaultView" type="enumeration" defaultValue="month">
8791
<caption>Initial selected view</caption>
8892
<description>Work week and agenda are only available in custom views</description>

packages/pluggableWidgets/calendar-web/src/__tests__/Calendar.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const defaultProps: CalendarContainerProps = {
2222
minHeight: 400,
2323
maxHeightUnit: "none",
2424
maxHeight: 400,
25-
overflowY: "auto"
25+
overflowY: "auto",
26+
showEventDate: true
2627
};
2728

2829
beforeAll(() => {

packages/pluggableWidgets/calendar-web/src/utils/calendar-utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,15 @@ export function extractCalendarProps(props: CalendarContainerProps): DragAndDrop
124124
}
125125
};
126126

127+
const formats = props.showEventDate ? {} : { eventTimeRangeFormat: () => "" };
128+
127129
return {
128130
components: {
129131
toolbar: CustomToolbar
130132
},
131133
defaultView: props.defaultView,
132134
events,
135+
formats,
133136
localizer,
134137
resizable: props.editable !== "never",
135138
selectable: props.enableCreate,

packages/pluggableWidgets/calendar-web/typings/CalendarProps.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface CalendarContainerProps {
4040
view: ViewEnum;
4141
editable: EditableEnum;
4242
enableCreate: boolean;
43+
showEventDate: boolean;
4344
defaultView: DefaultViewEnum;
4445
startDateAttribute?: EditableValue<Date>;
4546
eventDataAttribute?: EditableValue<string>;
@@ -80,6 +81,7 @@ export interface CalendarPreviewProps {
8081
view: ViewEnum;
8182
editable: EditableEnum;
8283
enableCreate: boolean;
84+
showEventDate: boolean;
8385
defaultView: DefaultViewEnum;
8486
startDateAttribute: string;
8587
eventDataAttribute: string;

0 commit comments

Comments
 (0)