Skip to content

Commit

Permalink
Fixed set weekday bug on calender with 'monday' as first weekday
Browse files Browse the repository at this point in the history
  • Loading branch information
belkevich committed Oct 2, 2013
1 parent 0744d5b commit 8ea502e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Categories/NSDate+Week.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8ea502e

Please sign in to comment.