From 8ea502e669e8097b13c2a3f989d13ad7348731e0 Mon Sep 17 00:00:00 2001 From: Alexey Belkevich Date: Wed, 2 Oct 2013 14:23:18 +0300 Subject: [PATCH] Fixed set weekday bug on calender with 'monday' as first weekday --- Categories/NSDate+Week.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Categories/NSDate+Week.m b/Categories/NSDate+Week.m index 79cc0b0..98978be 100644 --- a/Categories/NSDate+Week.m +++ b/Categories/NSDate+Week.m @@ -66,9 +66,9 @@ - (NSDate *)dateBySettingWeekOfMonth:(NSInteger)week - (NSDate *)dateBySettingWeekday:(NSInteger)weekday { - NSDateComponents *components = [self dateComponentsWeekTime]; - components.weekday = weekday; - return [[NSCalendar currentCalendar] dateFromComponents:components]; + NSDateComponents *components = [[NSDateComponents alloc] init]; + components.weekday = weekday - self.weekday; + return [[NSCalendar currentCalendar] dateByAddingComponents:components toDate:self options:0]; } - (NSDate *)dateByAddingWeek:(NSInteger)week