Skip to content

feat(calendar): add dateFormatToday option - #4293

Closed
ms-zone-41 wants to merge 1 commit into
MagicMirrorOrg:developfrom
ms-zone-41:feat/calendar-date-format-today
Closed

ms-zone-41 wants to merge 1 commit into
MagicMirrorOrg:developfrom
ms-zone-41:feat/calendar-date-format-today

Conversation

@ms-zone-41

@ms-zone-41 ms-zone-41 commented Oct 3, 2026 •

Copy link
Copy Markdown

Note

Draft – please do not review yet. I am still doing my own final review of this change. I will mark this PR as ready for review when it is done.

With timeFormat: "absolute", every event uses dateFormat. A format that works well for upcoming days (e.g. dddd DD.MM. HH:mm) is unnecessarily long for today's events, where the time is enough. showTimeToday does not help here, because it only affects relative times.

This PR adds a dateFormatToday option for timed events that start today.

Related issue

No related issue.

Changes

  • New option dateFormatToday (default "", which keeps the current behaviour). If set, it is used instead of dateFormat for timed events that start today in the absolute time format.
  • Full day events are not affected.
  • With showEnd, the start time is only added if dateFormatToday does not already contain a time (same check as for dateFormat). dateFormatIncludesTime() now takes the format to check as an optional parameter.
  • Unit tests for buildAbsoluteTimeText(). Three of them fail without the change.

Example:

config: {
	timeFormat: "absolute",
	dateFormat: "dddd DD.MM. HH:mm",
	dateFormatToday: "HH:mm"
}
Event before with dateFormatToday: "HH:mm"
today 09:00 Tuesday 01.01. 09:00 09:00
tomorrow 09:00 Wednesday 02.01. 09:00 Wednesday 02.01. 09:00

I will open a PR for the documentation (modules/calendar.md) as soon as this one looks fine to you.

Testing

  • npx vitest run tests/unit/modules/default/calendar (78 tests pass)
  • node --run test:unit (497 tests pass)
  • node --run test:lint and node --run test:spelling for the changed files
  • Running on my own mirror for a while

I used an AI coding assistant to help prepare this change. I reviewed and tested it myself.

With timeFormat "absolute" every event uses dateFormat, so events of
today show the full date as well (e.g. "Tuesday 01.01. 09:00"). The new
dateFormatToday option allows a shorter format for timed events that
start today, e.g. "HH:mm". Full day events are not affected and an
empty value (default) keeps the current behaviour.

When showEnd is used, the start time is only added if dateFormatToday
does not already contain a time.
@ms-zone-41

Copy link
Copy Markdown
Author

sorry, this PR was created too early
Nevertheless, it is a good time to say thank you to all reading the message for driving forward this great mirror platform.

@ms-zone-41 ms-zone-41 closed this Oct 9, 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.

1 participant