Skip to content

- (NSInteger)howManyDaysWithMonthInThisYear:(NSInteger)year withMonth:(NSInteger)month 优化 #195

Open
@zhufaming

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions