Skip to content

fix(calendar): sliced multi-day events start at 00:00, not 23:59#4208

Merged
KristjanESPERANTO merged 1 commit into
MagicMirrorOrg:developfrom
ago1776:fix/slice-multiday-midnight
Jul 17, 2026
Merged

fix(calendar): sliced multi-day events start at 00:00, not 23:59#4208
KristjanESPERANTO merged 1 commit into
MagicMirrorOrg:developfrom
ago1776:fix/slice-multiday-midnight

Conversation

@ago1776

@ago1776 ago1776 commented Jul 17, 2026

Copy link
Copy Markdown

Fixes #4206.

Problem

With sliceMultiDayEvents: true, multi-day events are split into (1/n), (2/n), … Every slice after the first was rendered with a start time of 23:59 instead of the next day's 00:00.

Cause

In defaultmodules/calendar/calendar.js, the slicing loop reuses midnight (which is .endOf("day") = 23:59:59.999) as the start of the following slice:

event.startDate = midnight.format("x"); // 23:59:59.999 of the next day

Fix

Set the next slice's start to the beginning of that day:

event.startDate = midnight.clone().startOf("day").format("x");

Regression test

As requested, added an electron regression test (sliceMultiDayEvents slice start time) plus a scenario slice_multiday_timed_start_midnight and a fixture with a timed event spanning several midnights (Fri 12:00 → Mon 08:00). It asserts that every rendered slice time cell contains a 00:00 start and never 23:59.

Verified locally:

  • with the fix: test passes;
  • without the fix: test fails on 23:59.

prettier, eslint and cspell are clean on the changed files.

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

@ago1776 Thanks for that. But please point your PR to the devlop branch, not to master.

With `sliceMultiDayEvents: true`, every slice after the first was given the
following day's `endOf("day")` (23:59:59.999) as its `startDate`, so slices
2..n rendered a start time of 23:59 instead of the next day's 00:00.

Set the next slice's start to `startOf("day")` of that day.

Adds an electron regression test (scenario `slice_multiday_timed_start_midnight`
with a timed event spanning several midnights): every rendered slice time cell
must contain a 00:00 start and never 23:59. Fails without the fix.

Closes MagicMirrorOrg#4206

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit 890db2b)
@ago1776
ago1776 force-pushed the fix/slice-multiday-midnight branch from 890db2b to ffcd8dd Compare July 17, 2026 11:13
@ago1776
ago1776 changed the base branch from master to develop July 17, 2026 11:13
@ago1776

ago1776 commented Jul 17, 2026

Copy link
Copy Markdown
Author

Retargeted this PR from master to develop and rebased the branch accordingly, per the contribution guidelines. The diff is unchanged — the one-line fix plus the regression test/mock/config. Thanks for the review!

@KristjanESPERANTO KristjanESPERANTO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks :)

@KristjanESPERANTO
KristjanESPERANTO merged commit e368fd6 into MagicMirrorOrg:develop Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] sliceMultiDayEvents: sliced sub-events after the first start at 23:59 instead of next-day 00:00

2 participants