Skip to content

feat: add date to active times display for cross-midnight sessions #243

@owieth

Description

@owieth

Problem

firstActiveAt and lastActiveAt store only HH:mm strings. If the Mac stays on overnight or resumes from sleep the next day, the displayed range (e.g. 22:45 - 09:30) is ambiguous — there's no date context to tell the user these times span two different days.

Proposed Solution

  1. EventMonitor.swift — change the time formatter from HH:mm to a full datetime format (e.g. yyyy-MM-dd'T'HH:mm) so the date is embedded in the stored value.

  2. MenuBarViewModel.swift — add a formattedActiveTimeRange computed property with smart formatting:

    • Same day as today → HH:mm - HH:mm (existing look, no change)
    • Spans two different dates → MMM d, HH:mm - MMM d, HH:mm (e.g. Mar 29, 22:45 - Mar 30, 09:30)
    • Graceful fallback for legacy HH:mm values already in the database
  3. MenuBarView.swift — use the new formatted property.

Notes

  • No DB migration needed — first_active_at / last_active_at columns are plain text; the wider format is backwards-compatible.
  • Legacy HH:mm values already stored will render as-is via fallback parsing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions