Skip to content

Feat: date-only relative label for all-day events (#85)#98

Merged
randomBrainstormer merged 1 commit into
mainfrom
feat/all-day-event-relative-label
Jun 5, 2026
Merged

Feat: date-only relative label for all-day events (#85)#98
randomBrainstormer merged 1 commit into
mainfrom
feat/all-day-event-relative-label

Conversation

@randomBrainstormer

@randomBrainstormer randomBrainstormer commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Request

From #85: a calendar of only holidays (all-day events) shows misleading time info in the right column. The user wants all-day events to read like "Today"/"Tomorrow"/weekday instead.

Why it happened

In the default timeFormat: "relative", all-day events fell through the timed-event logic:

  • Today's all-day event: startDate is today's midnight, which is < now, so it hit the "ongoing" branch → "Running".
  • An all-day event a few hours out: startDate - now < getRelative hours → "in 5 hours".
  • Otherwise: moment().calendar()"Today at 12:00 AM".

None of these make sense for something with no time of day.

Change

All-day events now render a date-only label — Today / Tomorrow / weekday / configured dateFormat — via a new fullDayEventRelativeLabel() helper. Timed events are untouched. Other modes (dateheaders already omits the time; absolute already has nextDaysRelative) are unchanged.

Localization — no new strings needed

This was the main concern on the issue. It rides entirely on existing infrastructure:

  • TODAY / TOMORROW are MagicMirror core translation keys (already used elsewhere in this module), shipped in every supported language.
  • Weekday names / date formats come from moment, which is already locale-aware (moment.updateLocale(config.language, ...) in start()).

So it works in all languages without touching translations/.

Test plan

  • npx jest — 30/30 pass (1 new test for the helper)
  • Visual: a holiday calendar shows "Today"/"Tomorrow"/weekday instead of "Running"/"in 5 hours"/"at 12:00 AM"

Note: version intentionally not bumped — the auto-bump workflow handles it on merge.

Closes #85

All-day events (e.g. holiday calendars) have no meaningful time of day,
but in the default "relative" timeFormat they rendered misleading time
info: today's event showed "Running", an event a few hours out showed
"in 5 hours", and otherwise "Today at 12:00 AM".

Render all-day events with a date-only label instead: Today / Tomorrow /
weekday / configured date format, via new fullDayEventRelativeLabel().

This reuses existing infrastructure only — TODAY/TOMORROW are MagicMirror
core translation keys and moment is locale-aware — so it works in every
supported language with no new translation strings. Timed events are
unchanged.

Adds a unit test for the helper.
@randomBrainstormer randomBrainstormer merged commit 4cea8a7 into main Jun 5, 2026
@randomBrainstormer randomBrainstormer deleted the feat/all-day-event-relative-label branch June 5, 2026 14:01
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.

Improve UX for All-day Events

1 participant