Feat: date-only relative label for all-day events (#85)#98
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:startDateis today's midnight, which is< now, so it hit the "ongoing" branch → "Running".startDate - now < getRelativehours → "in 5 hours".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 newfullDayEventRelativeLabel()helper. Timed events are untouched. Other modes (dateheadersalready omits the time;absolutealready hasnextDaysRelative) are unchanged.Localization — no new strings needed
This was the main concern on the issue. It rides entirely on existing infrastructure:
TODAY/TOMORROWare MagicMirror core translation keys (already used elsewhere in this module), shipped in every supported language.moment.updateLocale(config.language, ...)instart()).So it works in all languages without touching
translations/.Test plan
npx jest— 30/30 pass (1 new test for the helper)Note: version intentionally not bumped — the auto-bump workflow handles it on merge.
Closes #85