BYWEEKNO used to expand to every day in that week.
This doesn't really match the RFC as that say that BYDAY should 'expand'
with BYWEEKNO, but I would need it to 'limit'.
So what should we do? Choose one day from that week, but which?
- first day of the week
- same day of the week as DTSTART
- same day of the week as the date matching DTSTART in this year?
None are really ideal, and hopefully it would always be used with BYDAY.
As the last is easy I do that.
class byweekno:
'''
- WEEKNO 0 isn't allowed, and negatives aren't defined in the RFC.
+ WEEKNO 0 isn't allowed, and negatives aren't defined clearly in the RFC.
We allow WEEKNO=0 and -1 to be last week with at least 4 days
'''
def __init__(self, list):
st.norm_day()
st.set_wday()
for d in range(7):
- if st.yr == moment.yr:
+ if st.yr == moment.yr and st.wday == moment.wday:
rv.append(copy.copy(st))
+ break
st.day += 1
st.norm_day()
st.set_wday()
if 'BYYEARDAY' in rr.bylist or 'BYMONTHDAY' in rr.bylist:
act = -1
elif 'BYWEEKNO' in rr.bylist:
- act = -1
+ xtype = 'WEEKLY'
elif 'BYMONTH' in rr.bylist:
xtype = 'MONTHLY'
else: