keith / reminders-cli

A simple CLI for interacting with macOS reminders
MIT License
666 stars 53 forks source link

Add due date setting #20

Closed keith closed 3 years ago

keith commented 3 years ago

This allows passing --due-date or -d to add a due date for the reminder. There is way more logic than I would prefer here for a few reasons.

  1. EKReminder's due date is made up of date components. Whether or not you pass components containing values for times determines whether the reminder is saved as being due at a specific time, vs on a specific day.
  2. Any way I could come up with to parse natural language date strings doesn't differentiate between if the user specified a time or not, and all Date objects contain time info.

Because of this I've made the tradeoff to assume a time was not passed when we get the default time of 12pm from the parsed date. This means if you pass tomorrow at 12pm as a due date, the time will be ignored and only the date will be saved. Using tomorrow at 12:01pm works.

Thanks to this tip on using data detectors instead of deprecated NSDate APIs! https://twitter.com/ChristinaMltn/status/1327642022782578691