[TW-226] Additional recurrence functionality: 1st and 3rd Tuesdays (for example)
Cory Donnelly on 2010-08-02T19:57:25Z says:
My municipality picks up recycling on the first and third Tuesday of every month and there's currently no way to create a single task recurring at this schedule.
"Aha," you might say, "you could schedule the task for every two weeks." This won't work, consider this month:
August 2010
Su Mo Tu We Th Fr Sa
32 1 2 3 4 5 6 7
33 8 9 10 11 12 13 14
34 15 16 17 18 19 20 21
35 22 23 24 25 26 27 28
36 29 30 31
The first Tuesday is the 3rd, (okay), two weeks later is the 17th (also okay) but two weeks after that would be the 31st (not okay).
Migrated metadata:
Created: 2010-08-02T19:57:25Z
Modified: 2016-06-28T13:26:30Z
Federico Hernandez on 2010-08-08T20:28:42Z says:
Cory,
I would like you to think about syntax for this. how would you like to enter these values?
task add recur:1st3rdTuesday Recycling pick up
Theoretically a task like this would not require a due date - it is implicitly given in recur: but as task would need one how would you like to enter it?
task add recur:1st3rdTuesday due:1stTuesday Recycling pick up
But what happens if the next pickup tuesday would be the 3rd one when entering the task. It would be missed.
Federico Hernandez on 2010-08-08T20:31:17Z says:
The n'th occurrence of a weekday in year y and month m can be calculated with
d = 7 * occurrence - 6 + (weekday - dayOfWeek (y, m, 1)) % 7
d is the day of the month m in year y for the occurrence of the weekday.
Cory Donnelly on 2010-08-08T21:00:03Z says:
I'm thinking the due: field shouldn't behave any differently than for any other type of task. Consider this vanilla recurring task:
$ task add due:Wednesday recur:1w Trash pickup
Let's break this down:
We've:
- Specified the first scheduled occurrence
- Specified the recurrence schedule
For the '1st and 3rd Tuesdays' type of recurrence, we want to do the same.
$ task add due:Tuesday recur:1st3rdTuesday Recycling pick up $ task add due:Tomorrow recur:1st3rdTuesday Recycling pick up $ task add due:2010-08-10 recur:1st3rdTuesday Recycling pick up
One oddity is that there's no reason why we couldn't do the following:
$ task add due:Wednesday recur:1st3rdTuesday Recycling pick up
My immediate feeling is that this should throw an error. Can you think of a situation where this would make sense?
Federico Hernandez on 2010-08-08T21:20:40Z says:
Hmm.
I see your point.
$ task add due:Tuesday recur:1st3rdTuesday Recycling pick up $ task add due:Tomorrow recur:1st3rdTuesday Recycling pick up $ task add due:2010-08-10 recur:1st3rdTuesday Recycling pick up
but I guess the first example wiil (at least currently) produce the wrong result as "tuesday" means the next tuesday which could be the second one if you run the command between the first and second tuesday of a month. Should task check if the specified due date is in "sync" and "legal" with the given recurrence?
One oddity is that there's no reason why we couldn't do the following:
$ task add due:Wednesday recur:1st3rdTuesday Recycling pick upMy immediate feeling is that this should throw an error. Can you think of a situation where this would make sense?
Exactly. That is what I mean with the above check. OTOH I could think of a situation where it would make sense to allow your case. The first occurrence of a task needs to be done on a specific day or out of the regular scheme because you start/enter a certain regular scheme, e.g. pay for something with in a week, then every 1st Tuesday. And similar cases.
And just to complete and make your request symmetrical we should also add LastMonday, LastTuesday, ... as well.
Cory Donnelly on 2010-08-09T08:01:13Z says:
Federico Hernandez wrote:
but I guess the first example wiil (at least currently) produce the wrong result as "tuesday" means the next tuesday which could be the second one if you run the command between the first and second tuesday of a month. Should task check if the specified due date is in "sync" and "legal" with the given recurrence?
Yes, I think confirmation is necessary and appropriate for tasks created and specified as recurring in two steps as well as in a single step. Consider:
$ task add Mow the lawn Created task 1. $ task 1 recur:1st3rdTuesday You cannot specify a recurring task without a due date. $ task 1 due:Wednesday Modified 1 task. $ task 1 recur:1st3rdTuesday The due date of the specified task falls outside of the specified recurrence. Are you sure you want to proceed? (y/n) y Modified 1 task.[Choosing y causes the recurrence to be created as specified, choosing n cancels.]
I think this style of recurrence is almost fully fleshed out. There's still one last situation we need to think about. Consider this scenario.
Assume the current date is 2010-08-09.
$ task add Mow the lawn due:2010-09-21 // The third Tuesday of September. $ task 1 recur:1st3rdTuesday Modified 1 task.In this situation, I think the correct behaviour is to not warn the user that there are possible recurrences before their specified due date. Creating recurrences backwards in time is crazy.
Paul Beckingham on 2011-05-14T04:17:12Z says:
Needs libkronisk.
Paul Beckingham on 2012-07-21T13:15:46Z says:
I don't think libkronisk will be integrated in time for 2.2.0.
Saša Janiška on 2016-06-28T13:26:30Z says:
I have several tasks which need this feature, so:
+1