FAILURE MAP
← Case archive

FA-76946 / Calendar recurrence rules / Open access

Yearly BYMONTH/BYMONTHDAY with leap-day skipping: interval anchor · case 01

An every-other-year series whose first-year date precedes dtstart runs in the wrong year parity.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The interval is anchored at the first year with an eligible date instead of the dtstart year.

THE FAILURE

The interval is anchored at the first year with an eligible date instead of the dtstart year.

Unsuccessful approach: The partial repair `start[0] + k * interval + (1 if (month, day) <= start[1:] else 0)` still re-anchors the interval, now also when the date equals dtstart.

Case contract

FREQ=YEARLY on a fixed month and day. Years are dtstart.year + k*interval. A year in which the date does not exist (for example February 29 in a common year) is skipped, never clamped. Gregorian leap years: divisible by 4, except centuries not divisible by 400. Instances before dtstart are dropped and the series ends at until (inclusive). Return ISO dates.

Why this case matters

Recurring calendar series are expanded into concrete instances for display, reminders and conflict checks.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(dtstart, month, day, interval, until):
    start = tuple(int(x) for x in dtstart.split('-'))
    last = tuple(int(x) for x in until.split('-'))
    def is_leap(y):
        return y % 4 == 0 and (y % 100 != 0 or y % 400 == 0)
    out = []
    for k in range(500):
        y = start[0] + k * interval + (1 if (month, day) < start[1:] else 0)
        if y > last[0]:
            break
        dim = [31, 29 if is_leap(y) else 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1]
        dd = day
        if dd > dim:
            continue
        d = (y, month, dd)
        if d < start:
            continue
        if d > last:
            break
        out.append('%04d-%02d-%02d' % d)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: leap day across 2100',
   ['2092-02-29', 2, 29, 4, '2108-12-31'],
   ['2092-02-29', '2096-02-29', '2104-02-29', '2108-02-29']),
  ('leap day includes 2000',
   ['1996-02-29', 2, 29, 1, '2004-03-01'],
   ['1996-02-29', '2000-02-29', '2004-02-29']),
  ('anniversary before dtstart, interval 2',
   ['2024-06-01', 3, 15, 2, '2031-01-01'],
   ['2026-03-15', '2028-03-15', '2030-03-15']),
  ('until exactly on instance',
   ['2020-07-04', 7, 4, 1, '2023-07-04'],
   ['2020-07-04', '2021-07-04', '2022-07-04', '2023-07-04']),
  ('until year partial', ['2020-01-10', 12, 25, 1, '2022-06-30'], ['2020-12-25', '2021-12-25']),
  ('leap day from common year',
   ['2023-01-01', 2, 29, 1, '2033-01-01'],
   ['2024-02-29', '2028-02-29', '2032-02-29']),
  ('same month earlier day',
   ['2024-05-20', 5, 10, 1, '2027-12-31'],
   ['2025-05-10', '2026-05-10', '2027-05-10'])],
 [('anniversary before dtstart, interval 2',
   ['2024-06-01', 3, 15, 2, '2031-01-01'],
   ['2026-03-15', '2028-03-15', '2030-03-15']),
  ('until exactly on instance',
   ['2020-07-04', 7, 4, 1, '2023-07-04'],
   ['2020-07-04', '2021-07-04', '2022-07-04', '2023-07-04']),
  ('until year partial', ['2020-01-10', 12, 25, 1, '2022-06-30'], ['2020-12-25', '2021-12-25']),
  ('leap day from common year',
   ['2023-01-01', 2, 29, 1, '2033-01-01'],
   ['2024-02-29', '2028-02-29', '2032-02-29']),
  ('same month earlier day',
   ['2024-05-20', 5, 10, 1, '2027-12-31'],
   ['2025-05-10', '2026-05-10', '2027-05-10']),
  ('dtstart on anniversary',
   ['2021-11-11', 11, 11, 3, '2031-11-11'],
   ['2021-11-11', '2024-11-11', '2027-11-11', '2030-11-11']),
  ('interval 4 leap-day from 2023', ['2023-03-01', 2, 29, 4, '2040-12-31'], [])],
 [('until year partial', ['2020-01-10', 12, 25, 1, '2022-06-30'], ['2020-12-25', '2021-12-25']),
  ('leap day from common year',
   ['2023-01-01', 2, 29, 1, '2033-01-01'],
   ['2024-02-29', '2028-02-29', '2032-02-29']),
  ('same month earlier day',
   ['2024-05-20', 5, 10, 1, '2027-12-31'],
   ['2025-05-10', '2026-05-10', '2027-05-10']),
  ('dtstart on anniversary',
   ['2021-11-11', 11, 11, 3, '2031-11-11'],
   ['2021-11-11', '2024-11-11', '2027-11-11', '2030-11-11']),
  ('interval 4 leap-day from 2023', ['2023-03-01', 2, 29, 4, '2040-12-31'], []),
  ('year-end date',
   ['2019-12-31', 12, 31, 2, '2026-01-01'],
   ['2019-12-31', '2021-12-31', '2023-12-31', '2025-12-31']),
  ('century non-leap interval 1', ['2098-01-01', 2, 29, 1, '2105-01-01'], ['2104-02-29'])],
 [('same month earlier day',
   ['2024-05-20', 5, 10, 1, '2027-12-31'],
   ['2025-05-10', '2026-05-10', '2027-05-10']),
  ('dtstart on anniversary',
   ['2021-11-11', 11, 11, 3, '2031-11-11'],
   ['2021-11-11', '2024-11-11', '2027-11-11', '2030-11-11']),
  ('interval 4 leap-day from 2023', ['2023-03-01', 2, 29, 4, '2040-12-31'], []),
  ('year-end date',
   ['2019-12-31', 12, 31, 2, '2026-01-01'],
   ['2019-12-31', '2021-12-31', '2023-12-31', '2025-12-31']),
  ('century non-leap interval 1', ['2098-01-01', 2, 29, 1, '2105-01-01'], ['2104-02-29']),
  ('regression: leap day across 2100',
   ['2092-02-29', 2, 29, 4, '2108-12-31'],
   ['2092-02-29', '2096-02-29', '2104-02-29', '2108-02-29']),
  ('leap day includes 2000',
   ['1996-02-29', 2, 29, 1, '2004-03-01'],
   ['1996-02-29', '2000-02-29', '2004-02-29'])],
 [('interval 4 leap-day from 2023', ['2023-03-01', 2, 29, 4, '2040-12-31'], []),
  ('year-end date',
   ['2019-12-31', 12, 31, 2, '2026-01-01'],
   ['2019-12-31', '2021-12-31', '2023-12-31', '2025-12-31']),
  ('century non-leap interval 1', ['2098-01-01', 2, 29, 1, '2105-01-01'], ['2104-02-29']),
  ('regression: leap day across 2100',
   ['2092-02-29', 2, 29, 4, '2108-12-31'],
   ['2092-02-29', '2096-02-29', '2104-02-29', '2108-02-29']),
  ('leap day includes 2000',
   ['1996-02-29', 2, 29, 1, '2004-03-01'],
   ['1996-02-29', '2000-02-29', '2004-02-29']),
  ('anniversary before dtstart, interval 2',
   ['2024-06-01', 3, 15, 2, '2031-01-01'],
   ['2026-03-15', '2028-03-15', '2030-03-15']),
  ('until exactly on instance',
   ['2020-07-04', 7, 4, 1, '2023-07-04'],
   ['2020-07-04', '2021-07-04', '2022-07-04', '2023-07-04'])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: leap day across 2100['2092-02-29', '2096-02-29', '2104-02-29', '2108-02-29']['2092-02-29', '2096-02-29', '2104-02-29', '2108-02-29']Passed
leap day includes 2000['1996-02-29', '2000-02-29', '2004-02-29']['1996-02-29', '2000-02-29', '2004-02-29']Passed
anniversary before dtstart, interval 2['2025-03-15', '2027-03-15', '2029-03-15']['2026-03-15', '2028-03-15', '2030-03-15']Failed
until exactly on instance['2020-07-04', '2021-07-04', '2022-07-04', '2023-07-04']['2020-07-04', '2021-07-04', '2022-07-04', '2023-07-04']Passed
until year partial['2020-12-25', '2021-12-25']['2020-12-25', '2021-12-25']Passed
leap day from common year['2024-02-29', '2028-02-29', '2032-02-29']['2024-02-29', '2028-02-29', '2032-02-29']Passed
same month earlier day['2025-05-10', '2026-05-10', '2027-05-10']['2025-05-10', '2026-05-10', '2027-05-10']Passed

SHA-256 / f3aceb84bd47cbdd39df2adfebc1c0b3ffc6b85816ce2b4b5753dd4de969bca9

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import datetime as dt
import calendar
N = 1
observations = []
def solve(dtstart, month, day, interval, until):
    start = tuple(int(x) for x in dtstart.split('-'))
    last = tuple(int(x) for x in until.split('-'))
    def is_leap(y):
        return y % 4 == 0 and (y % 100 != 0 or y % 400 == 0)
    out = []
    for k in range(500):
        y = start[0] + k * interval + (1 if (month, day) <= start[1:] else 0)
        if y > last[0]:
            break
        dim = [31, 29 if is_leap(y) else 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1]
        dd = day
        if dd > dim:
            continue
        d = (y, month, dd)
        if d < start:
            continue
        if d > last:
            break
        out.append('%04d-%02d-%02d' % d)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: leap day across 2100',
   ['2092-02-29', 2, 29, 4, '2108-12-31'],
   ['2092-02-29', '2096-02-29', '2104-02-29', '2108-02-29']),
  ('leap day includes 2000',
   ['1996-02-29', 2, 29, 1, '2004-03-01'],
   ['1996-02-29', '2000-02-29', '2004-02-29']),
  ('anniversary before dtstart, interval 2',
   ['2024-06-01', 3, 15, 2, '2031-01-01'],
   ['2026-03-15', '2028-03-15', '2030-03-15']),
  ('until exactly on instance',
   ['2020-07-04', 7, 4, 1, '2023-07-04'],
   ['2020-07-04', '2021-07-04', '2022-07-04', '2023-07-04']),
  ('until year partial', ['2020-01-10', 12, 25, 1, '2022-06-30'], ['2020-12-25', '2021-12-25']),
  ('leap day from common year',
   ['2023-01-01', 2, 29, 1, '2033-01-01'],
   ['2024-02-29', '2028-02-29', '2032-02-29']),
  ('same month earlier day',
   ['2024-05-20', 5, 10, 1, '2027-12-31'],
   ['2025-05-10', '2026-05-10', '2027-05-10'])],
 [('anniversary before dtstart, interval 2',
   ['2024-06-01', 3, 15, 2, '2031-01-01'],
   ['2026-03-15', '2028-03-15', '2030-03-15']),
  ('until exactly on instance',
   ['2020-07-04', 7, 4, 1, '2023-07-04'],
   ['2020-07-04', '2021-07-04', '2022-07-04', '2023-07-04']),
  ('until year partial', ['2020-01-10', 12, 25, 1, '2022-06-30'], ['2020-12-25', '2021-12-25']),
  ('leap day from common year',
   ['2023-01-01', 2, 29, 1, '2033-01-01'],
   ['2024-02-29', '2028-02-29', '2032-02-29']),
  ('same month earlier day',
   ['2024-05-20', 5, 10, 1, '2027-12-31'],
   ['2025-05-10', '2026-05-10', '2027-05-10']),
  ('dtstart on anniversary',
   ['2021-11-11', 11, 11, 3, '2031-11-11'],
   ['2021-11-11', '2024-11-11', '2027-11-11', '2030-11-11']),
  ('interval 4 leap-day from 2023', ['2023-03-01', 2, 29, 4, '2040-12-31'], [])],
 [('until year partial', ['2020-01-10', 12, 25, 1, '2022-06-30'], ['2020-12-25', '2021-12-25']),
  ('leap day from common year',
   ['2023-01-01', 2, 29, 1, '2033-01-01'],
   ['2024-02-29', '2028-02-29', '2032-02-29']),
  ('same month earlier day',
   ['2024-05-20', 5, 10, 1, '2027-12-31'],
   ['2025-05-10', '2026-05-10', '2027-05-10']),
  ('dtstart on anniversary',
   ['2021-11-11', 11, 11, 3, '2031-11-11'],
   ['2021-11-11', '2024-11-11', '2027-11-11', '2030-11-11']),
  ('interval 4 leap-day from 2023', ['2023-03-01', 2, 29, 4, '2040-12-31'], []),
  ('year-end date',
   ['2019-12-31', 12, 31, 2, '2026-01-01'],
   ['2019-12-31', '2021-12-31', '2023-12-31', '2025-12-31']),
  ('century non-leap interval 1', ['2098-01-01', 2, 29, 1, '2105-01-01'], ['2104-02-29'])],
 [('same month earlier day',
   ['2024-05-20', 5, 10, 1, '2027-12-31'],
   ['2025-05-10', '2026-05-10', '2027-05-10']),
  ('dtstart on anniversary',
   ['2021-11-11', 11, 11, 3, '2031-11-11'],
   ['2021-11-11', '2024-11-11', '2027-11-11', '2030-11-11']),
  ('interval 4 leap-day from 2023', ['2023-03-01', 2, 29, 4, '2040-12-31'], []),
  ('year-end date',
   ['2019-12-31', 12, 31, 2, '2026-01-01'],
   ['2019-12-31', '2021-12-31', '2023-12-31', '2025-12-31']),
  ('century non-leap interval 1', ['2098-01-01', 2, 29, 1, '2105-01-01'], ['2104-02-29']),
  ('regression: leap day across 2100',
   ['2092-02-29', 2, 29, 4, '2108-12-31'],
   ['2092-02-29', '2096-02-29', '2104-02-29', '2108-02-29']),
  ('leap day includes 2000',
   ['1996-02-29', 2, 29, 1, '2004-03-01'],
   ['1996-02-29', '2000-02-29', '2004-02-29'])],
 [('interval 4 leap-day from 2023', ['2023-03-01', 2, 29, 4, '2040-12-31'], []),
  ('year-end date',
   ['2019-12-31', 12, 31, 2, '2026-01-01'],
   ['2019-12-31', '2021-12-31', '2023-12-31', '2025-12-31']),
  ('century non-leap interval 1', ['2098-01-01', 2, 29, 1, '2105-01-01'], ['2104-02-29']),
  ('regression: leap day across 2100',
   ['2092-02-29', 2, 29, 4, '2108-12-31'],
   ['2092-02-29', '2096-02-29', '2104-02-29', '2108-02-29']),
  ('leap day includes 2000',
   ['1996-02-29', 2, 29, 1, '2004-03-01'],
   ['1996-02-29', '2000-02-29', '2004-02-29']),
  ('anniversary before dtstart, interval 2',
   ['2024-06-01', 3, 15, 2, '2031-01-01'],
   ['2026-03-15', '2028-03-15', '2030-03-15']),
  ('until exactly on instance',
   ['2020-07-04', 7, 4, 1, '2023-07-04'],
   ['2020-07-04', '2021-07-04', '2022-07-04', '2023-07-04'])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: leap day across 2100[]['2092-02-29', '2096-02-29', '2104-02-29', '2108-02-29']Failed
leap day includes 2000['2000-02-29', '2004-02-29']['1996-02-29', '2000-02-29', '2004-02-29']Failed
anniversary before dtstart, interval 2['2025-03-15', '2027-03-15', '2029-03-15']['2026-03-15', '2028-03-15', '2030-03-15']Failed
until exactly on instance['2021-07-04', '2022-07-04', '2023-07-04']['2020-07-04', '2021-07-04', '2022-07-04', '2023-07-04']Failed
until year partial['2020-12-25', '2021-12-25']['2020-12-25', '2021-12-25']Passed
leap day from common year['2024-02-29', '2028-02-29', '2032-02-29']['2024-02-29', '2028-02-29', '2032-02-29']Passed
same month earlier day['2025-05-10', '2026-05-10', '2027-05-10']['2025-05-10', '2026-05-10', '2027-05-10']Passed

SHA-256 / b5a0ff36eada478d1e82cd431a96eecf3fbff87ed5945ae694fe1f52a02df852

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Stipulated, bounded recurrence-expansion model evaluated offline on explicit fixtures; it is not a complete iCalendar implementation and makes no claim of standards conformance. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:49:21.108663+00:00.

Case digest / 51afeee6a2c04afabb4b3e68b0c52e42c4973f43ff79de6f23e5cfc479a54361