Skip to content

Commit

Permalink
Don't add alarm for dates without times
Browse files Browse the repository at this point in the history
Natural language dates like `--due-date=today` don't have relevant time
info, so we don't add the time to the reminder. In this case if we add
an alarm with the date it just sets the time at midnight. In this case
we can just not add a time, which roughly matches the Reminders.app UI
where adding a date vs time is separate. If you pass `--due-date=9am` it
still sets the alarm correctly.

Fixes #79
  • Loading branch information
keith committed May 7, 2024
1 parent 710a498 commit 5b91f66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/RemindersLibrary/Reminders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public final class Reminders {
reminder.notes = notes
reminder.dueDateComponents = dueDateComponents
reminder.priority = Int(priority.value.rawValue)
if let dueDate = dueDateComponents?.date {
if let dueDate = dueDateComponents?.date, dueDateComponents?.hour != nil {
reminder.addAlarm(EKAlarm(absoluteDate: dueDate))
}

Expand Down

0 comments on commit 5b91f66

Please sign in to comment.