NSCalendarDate *date;
self->weekOfYear = _week;
- date = [[self startDate] mondayOfWeek:self->weekOfYear];
+ if(_week == 52 || _week == 53)
+ date = [[self startDate] mondayOfWeek];
+ else
+ date = [self startDate];
+ date = [date mondayOfWeek:_week];
[self setCurrentWeekStartDate:date];
}
}
- (NSCalendarDate *)endDate {
- NSCalendarDate *startDate;
-
- startDate = [self startDate];
- return [startDate dateByAddingYears:0 months:0 days:[startDate numberOfDaysInMonth]
- hours:0 minutes:0 seconds:0];
+ NSCalendarDate *startDate = [self startDate];
+ return [startDate dateByAddingYears:0
+ months:0
+ days:[startDate numberOfDaysInMonth]
+ hours:0
+ minutes:0
+ seconds:0];
}
-/* URLs (TODO: fix scroll ranges for months!) */
+/* URLs */
- (NSDictionary *)prevMonthQueryParameters {
NSCalendarDate *date;
-
- date = [[[self startDate] firstDayOfMonth] dateByAddingYears:0
- months:-1
- days:0
- hours:0
- minutes:0
- seconds:0];
+
+ date = [[self startDate] dateByAddingYears:0
+ months:-1
+ days:0
+ hours:0
+ minutes:0
+ seconds:0];
return [self queryParametersBySettingSelectedDate:date];
}
- (NSDictionary *)nextMonthQueryParameters {
NSCalendarDate *date;
- date = [[[self startDate] firstDayOfMonth] dateByAddingYears:0
- months:1
- days:0
- hours:0
- minutes:0
- seconds:0];
+ date = [[self startDate] dateByAddingYears:0
+ months:1
+ days:0
+ hours:0
+ minutes:0
+ seconds:0];
return [self queryParametersBySettingSelectedDate:date];
}