taskwarrior icon indicating copy to clipboard operation
taskwarrior copied to clipboard

Recur option does not handle "scheduled" events properly

Open nikhilchandra opened this issue 9 months ago • 4 comments

I have a few daily tasks that I perform as a routine. Here is an example of how I set it up.

task add project:workflows.home due:2025-03-17T9:30 scheduled:2025-03-17 recur:1d "Make new entry in journal."

After finishing the task, I mark it as done. However, it looks like for the next day's task, the due date updates to 2025-03-18, but the scheduled date remains 2025-03-17. Am I missing something?

nikhilchandra avatar Mar 17 '25 17:03 nikhilchandra

Hello, not a developer of tw but I thought I'd give a workaround. This is essentially a shortcoming of the current recurrence syntax and while a recurrence v2 has been talked about a lot, currently there isn't anyone working on it. (That might change!)

What I do for this case is to specify scheduled relative to due. Eg. task add due:today scheduled:due+6h or task add due:eod scheduled:due-7h. It should work the other way around, basing due off of the scheduled date. If you set this on your parent task and propagate it, it should work appropriately (use the +PARENT filter - remember to pass all for the default report but not for modifications; consider customizing the reports if that is confusing for you. Also note that +PARENT can have all of status:pending, status:deleted, and status:recurring with active child tasks afaik, which definitely tripped me up). If you try setting it on the child tasks and propagate from there, I think (but am not certain) that it may base it all on that child's due date.

If the 'today' being at 00:00 is confusing for you there are community made hooks to change that, see: https://github.com/tbabej/task.default-date-time . I haven't tested that hook myself and it was written a very long time ago, but it should be easy enough to replicate if it doesn't work9 out the gate.

ashprice avatar Apr 27 '25 16:04 ashprice

Thank you for your kind suggestions, I will give it a try!

nikhilchandra avatar Apr 28 '25 16:04 nikhilchandra

Hello again,

I thought I would write back because it seems that sometimes taskwarrior handles this correctly and other times it is bugged. I have found posts elsewhere documenting this bug from multiple years ago, but I also have tasks that were created correctly using syntax similar to that which I mentioned (which frustratingly, I cannot recreate).

I apologize if you tried my suggestion and had no luck, but, if you did have luck, and have the shell history for the cases that worked, it would be helpful if you could share the syntax you used; I am trying to figure out the syntaxes that work/that are broken. Maybe the reasons are obvious in TW's code, I haven't got to looking at that yet.

ashprice avatar May 06 '25 20:05 ashprice

The main original posts for this issue seems to be #97 and #1534 . One of them mentions a hook that might be useful to you: https://github.com/tbabej/task.shift-recurrence .

ashprice avatar May 06 '25 20:05 ashprice