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

KristjanESPERANTO merged 1 commit into
MagicMirrorOrg:developfrom
ago1776:fix/slice-multiday-midnight

Conversation

@ago1776

@ago1776 ago1776 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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 #4206

Co-Authored-By: Claude Opus 4.8 <[email protected]>
(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
Contributor 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
khassel pushed a commit that referenced this pull request Aug 18, 2026
While reviewing #4208, I had a bit of a headache figuring out the
`sliceMultiDay` logic. I cleaned that part up to make it easier to
follow and structurally clearer. In doing so, I noticed the previous
calculation was wrong in two edge cases:

- events crossing a DST change were not split by the actual calendar
days they touched
- events ending exactly at 00:00 were incorrectly counted as an
additional day

These cases are easy to miss because they are rare and only show up in
specific time windows or timezone transitions.

The logic now splits multi-day events by the calendar days they actually
cover and handles the boundary cases correctly.
@KristjanESPERANTO KristjanESPERANTO mentioned this pull request Oct 1, 2026
KristjanESPERANTO added a commit that referenced this pull request Oct 1, 2026
## Release Notes
Thanks to: @ago1776, @alkank, @Antra, @Blackspirits, @deBasMan21,
@flightlesstux, @i-xul, @jamalkamaladdin, @khassel, @KristjanESPERANTO,
@MannXo, @pascalpfammatter, @rejas
> ⚠️ This release needs nodejs version >=22.22.2 <23 || >=24

[Compare to previous Release
v2.37.0](v2.37.0...develop)


### [core]
- Prepare Release 2.38.0 (#4285)
- fix: let Electron select the Wayland display (#4268)
- fix(http): improve access error messages (#4281)
- fix: always redact client configuration (#4275)
- refactor: migrate browser scripts to ESM (#4272)
- refactor: convert animateCSS to ES module (#4266)
- use filter instead of find to get all allowed secrets when multiple
instances of a module are active (#4265)
- refactor: convert notificationFx to ES module (#4263)
- refactor: enforce function expression style (#4262)
- fix: validate client IP behind trusted proxies (#4261)
- prefer arrow over function (#4252)
- refactor(utils): simplify configuration validation and error handling
(#4240)
- fix(server): validate request origins (#4234)
- remove codeql warning (#4231)
- refactor(socket): use direct ESM import in main (#4225)
- refactor(socket): load Socket.IO client via ESM (#4224)
- style: simplify Electron startup checks (#4213)
- refactor: consolidate electron bootstrap into async function (#4210)
- refactor(module): simplify and fix configMerge (#4203)
- refactor: convert Translator to ES module (#4202)
- docs: add CodeQL review steps and restructure after-release checklist
(#4200)
- refactor: centralize server port resolution (#4198)
- refactor: use const instead of let for variable declarations (#4196)
- refactor: replace Loader object with named exports (#4195)
- set next release dev number
- refactor(eslint): enforce prefer-arrow-callback rule (#4251)
- refactor(http_fetcher): make dynamic URL handling explicit (#4282)
- refactor: use explicit global config (#4233)
- expand logic of hideConfigSecrets, add more tests (#4229)
- refactor: make browser startup more explicit (#4214)

### [dependencies]
- update dependencies (#4276)
- update dependencies incl. electron to v44 (#4250)
- chore: update eslint incl. plugins + review rules (#4236)
- Bump actions/stale from 10 to 11 (#4215)
- update dependencies (#4221)
- Bump actions/setup-node from 6 to 7 (#4204)
- chore: update dependencies (#4201)
- Bump electron from 42.5.2 to 43.0.0 (#4192)

### [modules/alert]
- Move alert translations into common translations (#4284)

### [modules/calendar]
- Fixes issue 4243: Ensure while loop in calendar module does not get
stuck when no entries (#4244)
- fix(calendar): escape HTML in event title and location (#4260)
- calendar: allow custom events to override symbol class (#4257)
- Fix calendar crash when yearmatchgroup regex does not match (#4239)
- fix(calendar): keep yearly events in DTSTART's month when BYMONTH is
missing (#4222)
- fix(calendar): correct multi-day slice day counts (#4232)
- chore: update dependencies + adapt calendar tests (#4211)
- fix(calendar): sliced multi-day events start at 00:00, not 23:59
(#4208)

### [modules/newsfeed]
- newsfeed: don't use cors url in njk template (#4279)
- refactor(newsfeed): extract feed item normalization into feeditem.js
(#4271)
- refactor(newsfeed): replace feedme lib with feedparser (#4269)
- newsfeed: fix allowedBasicHtmlTags (#4258)
- newsfeed: update checkArticleUrl (#4256)

### [modules/updatenotification]
- feat(updatenotification): implement trusted module configuration for
update commands (#4259)

### [modules/weather]
- feat: add FMI weather provider (#4278)
- feat(weather): enable CSS ordering for forecast and hourly columns
(#4118)
- fix(weather): respect initial load delay (#4254)
- fix(weather): restrict provider loading to the providers directory
(#4235)
- refactor(weather): extract WeatherProvider base class (#4228)

### [testing]
- ci: fail lint on warnings (#4230)
- add test if install works for minimal node version (#4197)

### [translation]
- feat(i18n): add Azerbaijani translation (#4283)
- feat(i18n): complete Turkish translations (#4277)
- Improve Portuguese translations (#4274)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Kevin G. <[email protected]>
Co-authored-by: veeck <[email protected]>
Co-authored-by: Veeck <[email protected]>
Co-authored-by: Karsten Hassel <[email protected]>
Co-authored-by: Jboucly <[email protected]>
Co-authored-by: Jboucly <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jarno <[email protected]>
Co-authored-by: sam detweiler <[email protected]>
Co-authored-by: Jordan Welch <[email protected]>
Co-authored-by: Blackspirits <[email protected]>
Co-authored-by: Samed Ozdemir <[email protected]>
Co-authored-by: in-voker <[email protected]>
Co-authored-by: Andrés Vanegas Jiménez <[email protected]>
Co-authored-by: cgillinger <[email protected]>
Co-authored-by: Sonny B <[email protected]>
Co-authored-by: sonnyb9 <[email protected]>
Co-authored-by: Morgan McBee <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: Mike Bishop <[email protected]>
Co-authored-by: ago1776 <[email protected]>
Co-authored-by: pascalpfammatter <[email protected]>
Co-authored-by: Pascal Pfammatter <[email protected]>
Co-authored-by: Anders Demant van der Weide <[email protected]>
Co-authored-by: Bas Buijsen <[email protected]>
Co-authored-by: Parman Mohammadalizadeh <[email protected]>
Co-authored-by: alkank <[email protected]>
Co-authored-by: Henkka <[email protected]>
Co-authored-by: Ercan Ermis <[email protected]>
Co-authored-by: Jamal Kamaladdinoglu <[email protected]>
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