Created
August 8, 2016 14:21
-
-
Save Li-blog/fb8eba27b2e858b7b31401e18ecf4dd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *getWeekStr(int weekInt) { | |
NSDate *startDate = [WCPreferencesManager sharedManager].startDate; | |
NSInteger dur = [WCPreferencesManager sharedManager].duration; | |
NSInteger startDay = [[WCPreferencesManager sharedManager].weekStartDay isEqualToString:@"Monday"] ? 1 : 0; | |
WCSemester *sem = [[WCSemester alloc] initWithStartDate:startDate duration:dur weekStartAt:startDay]; | |
NSInteger week = [sem weekNo:[NSDate date]]; | |
if (week == -1) { return @""; } | |
else { | |
NSString *display = [WCPreferencesManager sharedManager].displayFormat; | |
display = [display stringByReplacingOccurrencesOfString:@"\%W" withString:[NSString stringWithFormat:@"%ld", (long)week + weekInt]]; | |
return [display stringByAppendingString:@" "]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment