- (NSInteger)howManyDaysWithMonthInThisYear:(NSInteger)year withMonth:(NSInteger)month 优化 #195
Open
Description
你好,
这个方法能优化一下吗? 就像issues 中已经提到的
BOOL isLeapYear = false;
if((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))){
isLeapYear = true ;
}
NSArray *days = @[@"31",isLeapYear?@"29":@"28",@"31",@"30",@"31",@"30",@"31",@"31",@"30",@"31",@"30",@"31"];
return [days[month - 1] integerValue];
Metadata
Assignees
Labels
No labels