Skip to content

Commit e45f6cd

Browse files
samuelreichertrahmanunver
authored andcommitted
feat(calendar-web): add custom formats handling in CalendarPropsBuilder
1 parent 9544253 commit e45f6cd

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

packages/pluggableWidgets/calendar-web/src/helpers/CalendarPropsBuilder.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { ObjectItem } from "mendix";
2-
import { CalendarProps as ReactCalendarProps, Formats, NavigateAction, ViewsProps } from "react-big-calendar";
2+
import {
3+
CalendarProps as ReactCalendarProps,
4+
DateLocalizer,
5+
Formats,
6+
NavigateAction,
7+
ViewsProps
8+
} from "react-big-calendar";
39
import { withDragAndDropProps } from "react-big-calendar/lib/addons/dragAndDrop";
410

511
import { CalendarContainerProps } from "../../typings/CalendarProps";
@@ -115,6 +121,14 @@ export class CalendarPropsBuilder {
115121
formats.eventTimeRangeFormat = () => "";
116122
}
117123

124+
if (this.props.timeFormat?.status === "available") {
125+
const timeFormat = this.props.timeFormat.value ?? "hh:mm a";
126+
127+
formats.timeGutterFormat = (date: Date, _culture: string, localizer: DateLocalizer) => {
128+
return localizer.format(date, timeFormat);
129+
};
130+
}
131+
118132
return formats;
119133
}
120134

0 commit comments

Comments
 (0)