Skip to content

Commit b2353ec

Browse files
authored
Merge pull request #3592 from chmac/3553-round-two
fix: No longer break recurring tasks if scheduled dates are removed
2 parents dab4c5a + 2d21ff4 commit b2353ec

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

docs/Getting Started/Recurring Tasks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ When a task has multiple dates, one of them is selected as reference date based
198198
2. Scheduled date
199199
3. Start date
200200

201+
> If the "Remove scheduled date on recurrence" setting is true, the Start Date will be chosen before the Scheduled date.
202+
201203
If more dates than the reference date exist on the original recurring task, the next occurrence will have the same dates.
202204
All dates of the next occurring task will have the relative distance to the reference date that they had on the original task.
203205

src/Task/Occurrence.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ export class Occurrence {
5757
return window.moment(this.dueDate);
5858
}
5959

60+
// If the `removeScheduledDateOnRecurrence` setting is enabled, it does
61+
// not make sense to pick the scheduled date over the start date because
62+
// the scheduled date will be deleted in the newly created task. So if
63+
// this setting is enabled, and there is a start date, we pick that date
64+
// now before falling back on the standard logic below.
65+
const { removeScheduledDateOnRecurrence } = getSettings();
66+
if (removeScheduledDateOnRecurrence && this.startDate) {
67+
return window.moment(this.startDate);
68+
}
69+
6070
if (this.scheduledDate) {
6171
return window.moment(this.scheduledDate);
6272
}

tests/Task/Recurrence.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ describe('Recurrence - with removeScheduledDateOnRecurrence', () => {
284284
jest.useRealTimers();
285285
});
286286

287-
it.failing('calculates correct start date with "dropScheduledDate" and "when done", with no due date', () => {
287+
it('calculates correct start date with "dropScheduledDate" and "when done", with no due date', () => {
288288
// Arrange
289289

290290
// The task is being completed on the 10th of January.

0 commit comments

Comments
 (0)