Skip to content

edit --due with date-only sets hour:0 minute:0 instead of date-only reminder #23

@yulin0629

Description

@yulin0629

Description

When using remindctl edit <id> --due "2026-02-04" (date-only, no time component), the resulting reminder still has a time of 12:00 AM instead of being a true date-only (all-day) reminder.

Root Cause

In Sources/RemindCore/EventKitStore.swift, the calendarComponents(from:) method always includes .hour and .minute:

private func calendarComponents(from date: Date) -> DateComponents {
    calendar.dateComponents([.year, .month, .day, .hour, .minute], from: date)
}

When the input is a date-only string like "2026-02-04", the parsed Date defaults to midnight (00:00), so hour: 0, minute: 0 are always written into dueDateComponents. Apple Reminders treats this as a timed reminder at 12:00 AM, rather than a date-only reminder.

Expected Behavior

A date-only input (e.g., --due "2026-02-04") should produce a true all-day reminder — the same as toggling off the time switch in the Reminders GUI. This means dueDateComponents should only contain [.year, .month, .day] without .hour and .minute.

Suggested Fix

Track whether the user provided a time in the input. If not, use date-only components:

private func calendarComponents(from date: Date, dateOnly: Bool) -> DateComponents {
    if dateOnly {
        return calendar.dateComponents([.year, .month, .day], from: date)
    }
    return calendar.dateComponents([.year, .month, .day, .hour, .minute], from: date)
}

The dateOnly flag can be derived from the DateParsing layer — formats like YYYY-MM-DD, today, and tomorrow are date-only, while YYYY-MM-DD HH:mm and ISO 8601 with time are not.

Environment

  • remindctl 0.1.1
  • macOS 15 (Sequoia)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions