VladimirMarkelov / ttdl

TTDL - Terminal Todo List Manager
MIT License
209 stars 17 forks source link

feature request: --set-due argument should decode human-readable dates #28

Closed obbardc closed 4 years ago

obbardc commented 4 years ago

Currently the --set-due argument requires a date, it'd be nicer if it could accept a human-readable form like:

--set-due=tomorrow --set-due=3d --set-due=1w --set-due=1m

$ ttdl new snakes
Added todo:
# D P Created    Finished   Due        Threshold  Spent  Subject
-----------------------------------------------------------------
4                                                        snakes
$ ttdl edit 4 --set-due=2020-07-03
Changed todos:
# D P Created    Finished   Due        Threshold  Spent  Subject
-----------------------------------------------------------------
4                           2020-07-03                   snakes
-----------------------------------------------------------------
1 todos (of 4 total)
VladimirMarkelov commented 4 years ago

I am close to publishing a new version with this feature. But I have a question: I am going to add more "special" dates(besides tomorrow|tmr|tm and today) and I am not sure how to make them easy to understand. I added weekdays: --set-due=fri and --set-due=next-fri. What real due date do you expect from both commands for a date 2020-07-10 that is Friday? At this moment it is ambiguous(I can interpret fri and next-fri in two ways).

thomasjfox commented 4 years ago

While testing out the new feature today I didn't give it much thought and tried "due:tuesday". That is not recognized at the moment.

We might think about adding full day names for "due:" in addition to the abbreviation.

VladimirMarkelov commented 4 years ago

I agree. It makes sense.

thomasjfox commented 4 years ago

I took a look around the net what other implementations do. While there are quite a few parsers, many of them don't handle cases like "Monday after two weeks", just plain "Monday".

Two examples:

  1. TaskWarrior: Too many hardly used knobs IMHO: https://taskwarrior.org/docs/dates.html https://taskwarrior.org/docs/named_dates.html

  2. Official PHP implementation: https://www.php.net/manual/en/datetime.formats.relative.php https://www.php.net/manual/en/function.strtotime.php

echo strtotime("next Thursday"), "\n"
-> Thursday this week (if NOW is f.e. Tuesday)

I'll also ask coworkers tomorrow regarding https://github.com/VladimirMarkelov/ttdl/issues/28#issuecomment-657252837

VladimirMarkelov commented 4 years ago

Thank you for research! It seems that having bot "DAY_OF_WEEK" and "next DAY_OF_WEEK" adds ambiguity. So, we can keep simple WEEKDAY without any prefix and always choose this DAYOFWEEK in the future(in other words, it is always neither in the past not today).

obbardc commented 4 years ago

I agree keeping it simple is best. Friday should mean the next Friday in the calender, if I wanted it to be set to any other Friday I should have to put in a date.

On Tue, 14 Jul 2020, 22:51 Vladimir Markelov, notifications@github.com wrote:

Thank you for research! It seems that having "next DAY_OF_WEEK" adds ambiguity. So, we can keep simple WEEKDAY without any prefix and always choose this DAYOFWEEK in the future(in other words, it is always neither in the past not today).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/VladimirMarkelov/ttdl/issues/28#issuecomment-658431354, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH3LVVBUSWUGNTIMAHKQR3R3THKXANCNFSM4OOXWY6A .

VladimirMarkelov commented 4 years ago

OK. It seems done. If it looks good, I will publish new version. The current rules:

Numbers (shortcuts):

In some time interval

Named:

Extra rules:

thomasjfox commented 4 years ago

I think the new rules are perfect. Great job!

Personally I'll probably use "tuesday" or "14d" the most: A task is either on a fixed day soon or something more vague like "in two weeks". Example: "check bicycle tire pressure due:30d"

VladimirMarkelov commented 4 years ago

Thank you all for the discussion. Closing the issue as done one.