From 88950fd3f94f9d0e9343b96246f685a6b78ab5f9 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Mon, 8 Feb 2021 12:47:36 -0600 Subject: [PATCH] Add monthly repeat test --- .../astrid/repeats/RepeatMonthlyTests.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/src/test/java/com/todoroo/astrid/repeats/RepeatMonthlyTests.kt b/app/src/test/java/com/todoroo/astrid/repeats/RepeatMonthlyTests.kt index 55912850c..c05d5a7d5 100644 --- a/app/src/test/java/com/todoroo/astrid/repeats/RepeatMonthlyTests.kt +++ b/app/src/test/java/com/todoroo/astrid/repeats/RepeatMonthlyTests.kt @@ -55,4 +55,23 @@ class RepeatMonthlyTests : RepeatTests() { assertEquals(newDayTime(2017, 2, 28, 13, 30), next) } + + /* https://tools.ietf.org/html/rfc5545#section-3.3.10 + * Recurrence rules may generate recurrence instances with an invalid + * date (e.g., February 30) or nonexistent local time (e.g., 1:30 AM + * on a day where the local time is moved forward by an hour at 1:00 + * AM). Such recurrence instances MUST be ignored and MUST NOT be + * counted as part of the recurrence set. + */ + @Test + fun repeatJanuary30th() { + val task = newFromDue( + "FREQ=MONTHLY;INTERVAL=1", + newDayTime(2017, 1, 30, 13, 30) + ) + + val next = calculateNextDueDate(task) + + assertEquals(newDayTime(2017, 3, 30, 13, 30), next) + } } \ No newline at end of file