+2008-03-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * iCalTimeZonePeriod.m ([iCalTimeZonePeriod
+ -dayOfWeekFromRruleDay:day]): the algorithm would never work if
+ the day was monday. After it was changed for sunday (see below),
+ it would return 1 instead of 0.
+
+ * iCalRecurrenceRule.m ([iCalRecurrenceRule -setByDayMask:_mask]):
+ the first day of the week is always sunday, following Apple's
+ documentation.
+
2008-03-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* NGVCardReference.[hm]: new class module that implements the base
} iCalRecurrenceFrequency;
typedef enum {
- iCalWeekDayMonday = 1,
- iCalWeekDayTuesday = 2,
- iCalWeekDayWednesday = 4,
- iCalWeekDayThursday = 8,
- iCalWeekDayFriday = 16,
- iCalWeekDaySaturday = 32,
- iCalWeekDaySunday = 64,
+ iCalWeekDaySunday = 1,
+ iCalWeekDayMonday = 2,
+ iCalWeekDayTuesday = 4,
+ iCalWeekDayWednesday = 8,
+ iCalWeekDayThursday = 16,
+ iCalWeekDayFriday = 32,
+ iCalWeekDaySaturday = 64,
} iCalWeekDay;
@class NSString, NSCalendarDate, NGCalendarDateRange, NSArray;
{
NSMutableArray *days;
unsigned int count;
- unsigned char maskDays[] = { iCalWeekDayMonday, iCalWeekDayTuesday,
- iCalWeekDayWednesday, iCalWeekDayThursday,
- iCalWeekDayFriday, iCalWeekDaySaturday,
- iCalWeekDaySunday };
+ unsigned char maskDays[] = { iCalWeekDaySunday, iCalWeekDayMonday,
+ iCalWeekDayTuesday, iCalWeekDayWednesday,
+ iCalWeekDayThursday, iCalWeekDayFriday,
+ iCalWeekDaySaturday };
days = [NSMutableArray arrayWithCapacity: 7];
if (_mask)
{
{
unsigned int dayOfWeek;
- dayOfWeek = 1;
- while (day >> dayOfWeek)
+ dayOfWeek = 0;
+ while (day >> (dayOfWeek + 1))
dayOfWeek++;
return dayOfWeek;
day: 0 hour: 0 minute: 0
second: -[self _secondsOfOffset: @"tzoffsetfrom"]];
dateDayOfWeek = [tmpDate dayOfWeek];
- offset = (dayOfWeek - dateDayOfWeek);
- if (pos > 0 && offset < 0)
- offset += 7;
- offset += (pos * 7);
+// #warning FIXME
+ offset = (dayOfWeek - dateDayOfWeek) + ((pos -1 ) * 7);
tmpDate = [tmpDate addYear: 0 month: 0 day: offset
hour: 0 minute: 0 second: 0];