Giter Club home page Giter Club logo

nscalendarextension's Introduction

NSCalendarExtension

Introduction

  • Use high-level interfaces of NSCalendar and NSDateComponents in lower iOS version than iOS8

The main purpose of this repo is to support FSCalendar with a iOS7-compatibility, but even if you didn't use it, you can also benefit with this repo and get rid of the unrecognized selector crash when you use these api UNDER iOS8.0.

// NSCalendar
@interface NSCalendar

 + (nullable NSCalendar *)calendarWithIdentifier:(NSString *)calendarIdentifier;
 
 - (nullable NSDate *)dateWithEra:(NSInteger)eraValue year:(NSInteger)yearValue month:(NSInteger)monthValue day:(NSInteger)dayValue hour:(NSInteger)hourValue minute:(NSInteger)minuteValue second:(NSInteger)secondValue nanosecond:(NSInteger)nanosecondValue;
 
 - (nullable NSDate *)dateWithEra:(NSInteger)eraValue yearForWeekOfYear:(NSInteger)yearValue weekOfYear:(NSInteger)weekValue weekday:(NSInteger)weekdayValue hour:(NSInteger)hourValue minute:(NSInteger)minuteValue second:(NSInteger)secondValue nanosecond:(NSInteger)nanosecondValue;
 
 - (NSDate *)dateByAddingUnit:(NSCalendarUnit)unit value:(NSInteger)value toDate:(NSDate *)date options:(NSCalendarOptions)options;
 
 - (NSInteger)component:(NSCalendarUnit)component fromDate:(NSDate *)date;
 
 - (BOOL)isDate:(NSDate *)date1 inSameDayAsDate:(NSDate *)date2;
 
 - (BOOL)isDateInToday:(NSDate *)date;
 
 - (BOOL)isDateInYesterday:(NSDate *)date;
 
 - (BOOL)isDateInTomorrow:(NSDate *)date;
 
 - (BOOL)isDateInWeekend:(NSDate *)date;
 
 - (NSComparisonResult)compareDate:(NSDate *)date toDate:(NSDate *)date toUnitGranularity:(NSCalendarUnit)unit;
 
 - (BOOL)isDate:(NSDate *)date1 equalToDate:(NSDate *)date2 toUnitGranularity:(NSCalendarUnit)unit;

@end

// NSDateComponents
@interface NSDateComponents

 - (void)setValue:(NSInteger)value forComponent:(NSCalendarUnit)unit;
 
 - (NSInteger)valueForComponent:(NSCalendarUnit)unit;
 
@end

How to use

  • Just drag files under Source folder into your project..

  • Available in iOS6 and iOS7

  • As the implementations are injected with runtime techs, you DON'T have to do #import.
  • All testings are going under the Unit Test target.

nscalendarextension's People

Contributors

wenchaod avatar

Watchers

mr.huangjian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.