Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Improve next-date calculation for monthly and yearly recurring tasks #1197

Merged
merged 31 commits into from
Oct 8, 2022
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a20fd20
Ensure monthly and yearly recurrences
schemar Sep 30, 2022
f64be7d
Adding code comments
schemar Sep 30, 2022
1ac2ffd
Adding tests from @claremacrae
schemar Sep 30, 2022
9b4ac16
Fixed edge cases across years
schemar Sep 30, 2022
1e17359
Document recurrence edge cases
schemar Sep 30, 2022
e698ce4
Merge branch 'main' into monthly_recurrence
claremacrae Oct 3, 2022
13afc74
test: Test recurrence corrects next date with 'when done'
claremacrae Oct 3, 2022
b9c9335
vault: Add Recurrence handling invalid dates.md
claremacrae Oct 3, 2022
785a687
vault: Capture current behaviour of 'very month on the'
claremacrae Oct 3, 2022
3f2eca6
vault: Simplify re-testing of recurrence on fixed days
claremacrae Oct 3, 2022
a24abbf
vault: Demonstrate a bug that 'every month on the 31st' gets stuck
claremacrae Oct 3, 2022
a720af4
vault: Remove misleading task descriptions
claremacrae Oct 3, 2022
e3bbc5d
vault: Enable outline core plugin
claremacrae Oct 3, 2022
fdacb07
vault: Set up manual testing of 'every month on the last'
claremacrae Oct 3, 2022
7e3b7b0
vault: Capture current behaviour of 'every month on the last'
claremacrae Oct 3, 2022
d030c25
vault: Capture new behaviour of 'every month on the last'
claremacrae Oct 3, 2022
fc93ffd
test: Guard against recurrence tests with no expectations set
claremacrae Oct 3, 2022
accc340
work in progress on recurring - do
claremacrae Oct 3, 2022
74ace8d
work in progress on recurring - do
claremacrae Oct 3, 2022
4c9bae9
docs: Document behavior if reference date is invalid
claremacrae Oct 3, 2022
a599be8
docs: Remove obsolete instruction about ordering of recurrence rule.
claremacrae Oct 6, 2022
ec4ad8b
fix: Prevent 'every month on the 31st' sticking on 31st January
claremacrae Oct 6, 2022
affa9dc
vault: Update sample file with fixed behavior for 'every month on the…
claremacrae Oct 6, 2022
ef51126
docs: Add major new section: 'How the New Date is Calculated: Repeati…
claremacrae Oct 6, 2022
f4870c0
docs: Add new section: 'Technical Details'
claremacrae Oct 6, 2022
1b7cbf9
docs: Add markdown codeblocks to tasks in new sections
claremacrae Oct 6, 2022
695abf3
docs: Use more representative done does in sample tasks
claremacrae Oct 6, 2022
d0d1e4e
docs: Warn against use of 'every month on the 31st'
claremacrae Oct 6, 2022
98ac13f
docs: Warn near top of file about skipped recurrences
claremacrae Oct 7, 2022
eac9896
test: Add test to see whether 'every year on' needs special case. It …
claremacrae Oct 8, 2022
24862ba
refactor: code review: Remove repeated calls to Recurrence.toText()
claremacrae Oct 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: Guard against recurrence tests with no expectations set
  • Loading branch information
claremacrae committed Oct 3, 2022
commit fc93ffdc2b09fd24d9485b8939f7d5abd73b43aa
8 changes: 7 additions & 1 deletion tests/Task.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ describe('toggle done', () => {
nextDue: '2021-02-28',
},

// Testing 'when done' does not skip when next occurence is an invalid date
// Testing 'when done' does not skip when next occurrence is a non-existent date
{
interval: 'every month when done',
scheduled: '1999-01-23',
Expand All @@ -691,6 +691,12 @@ describe('toggle done', () => {
({ interval, due, scheduled, start, today, nextDue, nextScheduled, nextStart }) => {
const todaySpy = jest.spyOn(Date, 'now').mockReturnValue(moment(today).valueOf());

// If this test fails, the RecurrenceCase had no expected new dates set, and so
// is accidentally not doing any testing.
const atLeaseOneExpectationSupplied =
nextStart !== undefined || nextDue !== undefined || nextScheduled !== undefined;
expect(atLeaseOneExpectationSupplied).toStrictEqual(true);

const line = [
'- [ ] I am task',
`🔁 ${interval}`,
Expand Down