Skip to content

Commit 8be0d84

Browse files
committed
chore: allow last hour of the day
1 parent 3421bc9 commit 8be0d84

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

apps/frontend/src/components/questionnaire/calendar/EntryCalendar.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ const calendarBaseConfig: FullCalendar["props"] = {
2222
slotMaxTime: C.calendar.maxTime,
2323
slotDuration: { hour: 1 },
2424
firstDay: 1,
25-
locale: "de",
25+
locale: "en-GB",
2626
expandRows: true,
2727
editable: true,
28-
selectAllow: ({ start, end }) => isSame("day", start, end),
28+
selectAllow: ({ start, end }) => {
29+
end.setTime(end.getTime() - 1000);
30+
return isSame("day", start, end);
31+
},
2932
selectable: true,
3033
selectLongPressDelay: 200,
3134
eventLongPressDelay: 400,
@@ -116,7 +119,7 @@ export function EntryCalendar({
116119
},
117120
{
118121
start: getDateFromTimeAndWeekday(maxEnd, index),
119-
end: getDateFromTimeAndWeekday("23:00:00", index),
122+
end: getDateFromTimeAndWeekday("23:59:59", index),
120123
backgroundColor: theme.colors.uzhBlue[9],
121124
className: styles.eventSleepIndicator,
122125
display: "background",
@@ -143,7 +146,10 @@ export function EntryCalendar({
143146
};
144147

145148
const setupEntryCreate = ({ start, end }: DateSelectArg | EventImpl) => {
146-
setEntryDraft({ startedAt: getTime(start!), endedAt: getTime(end!), weekday: start!.getDay() });
149+
if (!start || !end) return;
150+
if (end.getHours() === 0 && end.getMinutes() === 0) end.setTime(end.getTime() - 1000);
151+
152+
setEntryDraft({ startedAt: getTime(start), endedAt: getTime(end), weekday: start!.getDay() });
147153
setEntryUpdadingId(undefined);
148154
open();
149155
};

apps/frontend/src/configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export const C = {
1414
},
1515
calendar: {
1616
minTime: "05:00",
17-
maxTime: "23:00",
17+
maxTime: "23:59",
1818
},
1919
};

0 commit comments

Comments
 (0)