erica / NSDate-Extensions

Practical real-world dates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

isWorkday or isWeekend

SlavaBushtruk opened this issue · comments

Would be nice. Thanks

  • (BOOL) isTypicallyWeekend
    {
    NSDateComponents *components = [CURRENT_CALENDAR components:NSYearCalendarUnit fromDate:self];
    if ((components.weekday == 1) ||
    (components.weekday == 7))
    return YES;
    return NO;
    }
  • (BOOL) isTypicallyWorkday
    {
    return ![self isTypicallyWeekend];
    }

-- E, totally not looking up calendars and holidays and bank mondays

Grep foo whilst ye may oh daemons of the spring

On May 4, 2012, at 3:42 AM, Slava Bushtruk reply@reply.github.com wrote:

Would be nice. Thanks


Reply to this email directly or view it on GitHub:
#12

Added

Just a slight problem with the components for isTypicallyWeekend: should be NSWeekdayCalendarUnit otherwise it will always return NO.