Skip to content

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

Description

@ago1776

Platform

  • MagicMirror² v2.37.0
  • default calendar module, sliceMultiDayEvents: true

Bug

With sliceMultiDayEvents: true, a multi-day event is split into per-day slices (1/n), (2/n), … Every slice after the first is displayed as starting at 23:59 instead of the following day's 00:00.

Cause

modules/default/calendar/calendar.js, in the slicing loop (around L513–535):

let midnight = eventStartDateMoment.clone().startOf("day").add(1, "day").endOf("day");
...
event.startDate = midnight.format("x");   // start of the NEXT slice
...
midnight = midnight.clone().add(1, "day").endOf("day");

midnight is .endOf("day") (= 23:59:59.999), but it is assigned as the following slice's startDate. So each subsequent slice starts at 23:59:59.999 of the previous day instead of 00:00 of its own day, which is what gets rendered as "… 23:59".

Fix

Use the start of the day for the next slice's start:

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

Reproduce

Any all-day or timed event spanning ≥2 midnights with sliceMultiDayEvents: true; slices 2..n show "… 23:59".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions