GothenburgBitFactory / taskwarrior

Taskwarrior - Command line Task Management
https://taskwarrior.org
MIT License
4.3k stars 287 forks source link

Allow multiple dateformats #2427

Open FreddieOliveira opened 3 years ago

FreddieOliveira commented 3 years ago

By allowing dateformat option to be set to something like

dateformat='D/M/Y','D/M','D'

it would be possible to specify the day, month and year with due:15/03/2021 or only the day and month (using the current year) with due:15/03 or only the day (using the current month and year) with due:15.

This may be related to #2376.

mrossinek commented 3 years ago

I am not sure what your feature request is exactly, as this is already supported. See e.g.: https://man.archlinux.org/man/community/task/taskrc.5.en#DATES

The issue which you have linked to is (to the best of my knowledge) an open problem with the inferred year when using the date:15/03 notation (for example).

FreddieOliveira commented 3 years ago

I'm a new taskwarrior user, but as far as I tested it, my issue is not solved.

To be more clear, my ~/.taskrc file contains

dateformat=D/M/Y

but it's kind of inconvenient to write the year every time when creating tasks with due dates. So, if you execute

task add due:15/03 'Test task'

you get the error

'15/03' is not a valid date in the 'D/M/Y' format

The same thing happens if you specify only the day

task add due:15 'Test task'

I'd like taskwarrior to use the current month and year when they are missing.

allgreed commented 1 year ago

The ISO-8601 Format, available since 2.4.0 helps a bit, however I tend to forget how the format is called, where to search for it and intricate details, such as: 2023-12-01 is valid, however 2023-12-1 is not.

So currently I have a dateformat set to d.M, which covers 99+% of my usage and for the rare cases where I'd like to specify a date in a different year I'll use the ISO (after 15 minutes of trying to get it right, because I use it so infrequent xD).

A low hanging fruit might be to mention the name of the ISO format when a date is found invalid, but I can also imagine it may annoy a lof of folks.