-
Notifications
You must be signed in to change notification settings - Fork 115
Description
The following cases related to BYWEEKNO fail:
RRULE:FREQ=YEARLY;BYWEEKNO=1,2;UNTIL=20170101T000000Z
DTSTART:20130108T000000
Expected INSTANCES:20130108T000000,20131231T000000,20140107T000000,20141230T000000,20150106T000000,20160105T000000,20160112T000000
Actual INSTANCES:20130115T000000,20130122T000000,20140114T000000,20140121T000000,20150113T000000,20150120T000000,20160112T000000,20160119T000000
RRULE:FREQ=YEARLY;BYWEEKNO=-1,-2
DTSTART:20131224T000000
Expected INSTANCES:20131224T000000
Actual INSTANCES: *** MALFORMEDDATA: An input string was not correctly formed or a component has missing or extra properties
RRULE:FREQ=YEARLY;BYWEEKNO=-1,-2;COUNT=6
DTSTART:20270102
Expected INSTANCES:20270102,20271225,20280101,20281223,20281230
Actual INSTANCES:20271225,20280101,20281223,20281230,20291222,20291229Warning
The RFC is somewhat ambiguous when it comes to BYWEEKNO. In particular it is unclear how to deal with recurrences in the first and last week of the year if those cross the year boundary. Different libraries implement this case differently. See related discussions here:
- Test cases related to
BYWEEKNO+BYMONTHDAY, etc. could be wrong ical-org/ical.net#791 - https://stackoverflow.com/questions/48064349/yearly-rrule-interpretation-when-more-than-one-of-bymonth-byweekno-byyearday-a
The test cases in this issue are based on the implementation that libical has followed so far, i.e. that in case BYWEEKNO is present, the individual years are assumed to start on the first day of week no. 1 (and end the day before the first day of the following year). Whether or not there is consent on this behavior throughout the libical project may require further discussions.
Reproduced on Ubuntu with ICU and Windows without ICU.
These are more test cases related to WEEKNO which may or may not have the same root cause. I'm also not 100% sure that my interpretation of the expected outcome is correct. The test cases are based on the assumption that 2010-01-02 belongs to week 53 of 2009 (not 2010). So the yearly interval starts counting from 2009 and after 6y we are at 2015, not 2016.
# The first date belongs to 2009, so after 6 years it will be 2015, which has a week 53.
RRULE:FREQ=YEARLY;BYWEEKNO=53;BYDAY=TU,SA;INTERVAL=6;UNTIL=20170101T000000Z
DTSTART:20100102T000000
INSTANCES:20100102T000000,20151229T000000,20160102T000000
# The first date belongs to 2009, so after 5 years it will be 2014, which has NO week 53.
RRULE:FREQ=YEARLY;BYWEEKNO=53;BYDAY=TU,SA;INTERVAL=5;UNTIL=20170101T000000Z
DTSTART:20100102T000000
INSTANCES:20100102T000000
# The first date belongs to 2009, so after 7 years it will be 2014, which has NO week 53.
RRULE:FREQ=YEARLY;BYWEEKNO=53;BYDAY=TU,SA;INTERVAL=7;UNTIL=20170101T000000Z
DTSTART:20100102T000000
INSTANCES:20100102T000000
# DTSTART is in 2024 but the week belongs to 2025, so after 3 years it will be 2028.
RRULE:FREQ=YEARLY;BYWEEKNO=1;BYDAY=MO,TU;INTERVAL=3;UNTIL=20320101
DTSTART:20241231
INSTANCES:20241231,20280103,20280104,20301230,20301231Test outcome:
Test case at line 478 failed.
RRULE:FREQ=YEARLY;BYWEEKNO=53;BYDAY=TU,SA;INTERVAL=6;UNTIL=20170101T000000Z
DTSTART:20100102T000000
Expected INSTANCES:20100102T000000,20151229T000000,20160102T000000
Actual INSTANCES:
Test case at line 483 failed.
RRULE:FREQ=YEARLY;BYWEEKNO=53;BYDAY=TU,SA;INTERVAL=5;UNTIL=20170101T000000Z
DTSTART:20100102T000000
Expected INSTANCES:20100102T000000
Actual INSTANCES:20151229T000000,20160102T000000
Test case at line 488 failed.
RRULE:FREQ=YEARLY;BYWEEKNO=53;BYDAY=TU,SA;INTERVAL=7;UNTIL=20170101T000000Z
DTSTART:20100102T000000
Expected INSTANCES:20100102T000000
Actual INSTANCES:
Test case at line 493 failed.
RRULE:FREQ=YEARLY;BYWEEKNO=1;BYDAY=MO,TU;INTERVAL=3;UNTIL=20320101
DTSTART:20241231
Expected INSTANCES:20241231,20280103,20280104,20301230,20301231
Actual INSTANCES:20270104,20270105,20291231,20300101
Some related tests have been added in #889 for cases that are explicitly marked as not implemented as of today.