Skip to content

Commit 753d212

Browse files
authored
Don't add alarm for dates without times (#81)
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
1 parent 710a498 commit 753d212

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/RemindersLibrary/Reminders.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public final class Reminders {
316316
reminder.notes = notes
317317
reminder.dueDateComponents = dueDateComponents
318318
reminder.priority = Int(priority.value.rawValue)
319-
if let dueDate = dueDateComponents?.date {
319+
if let dueDate = dueDateComponents?.date, dueDateComponents?.hour != nil {
320320
reminder.addAlarm(EKAlarm(absoluteDate: dueDate))
321321
}
322322

0 commit comments

Comments
 (0)