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