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.
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.
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.
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.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. Usingtomorrow at 12:01pm
works.Thanks to this tip on using data detectors instead of deprecated NSDate APIs! https://twitter.com/ChristinaMltn/status/1327642022782578691