Skip to content

Commit

Permalink
Merged branch bugfix/actulaly-fix-it into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
horia141 committed Oct 30, 2024
1 parent 6100114 commit a89ac09
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/webui/app/routes/workspace/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2497,20 +2497,14 @@ function splitTimeEventInDayEntryIntoPerDayEntries(
} {
const startTime = calculateStartTimeForTimeEvent(entry.time_event_in_tz);
const endTime = calculateEndTimeForTimeEvent(entry.time_event_in_tz);
const epochDate = aDateToDate("1970-01-01");
const startDaysSinceEpoch = Math.floor(
startTime.diff(epochDate, "days").as("days")
);
const endDaysSinceEpoch = Math.floor(
endTime.diff(epochDate, "days").as("days")
);
const diffInDays = endTime.startOf('day').diff(startTime.startOf('day'), 'days').days;

if (startDaysSinceEpoch === endDaysSinceEpoch) {
if (diffInDays === 0) {
// Here we have only one day.
return {
day1: entry,
};
} else if (startDaysSinceEpoch + 1 === endDaysSinceEpoch) {
} else if (diffInDays === 1) {
// Here we have two days.
const day1TimeEvent = {
...entry.time_event_in_tz,
Expand Down Expand Up @@ -2543,7 +2537,7 @@ function splitTimeEventInDayEntryIntoPerDayEntries(
},
},
};
} else if (startDaysSinceEpoch + 2 === endDaysSinceEpoch) {
} else if (diffInDays === 2) {
// Here we have three days.
const day1TimeEvent = {
...entry.time_event_in_tz,
Expand Down

0 comments on commit a89ac09

Please sign in to comment.