CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

FRDateRange 0.2.0

FRDateRange 0.2.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2015

Maintained by Jonathan Dalrymple.



 
Depends on:
NSDate-Escort~> 1.4.0
FRDateFormatterCache~> 0.2.0
 

  • By
  • Jonathan Dalrymple

FRDateRange exists to encapsulate date ranges, and provide helper methods for calcuating if a date lies within it's range;

Usage

Firstly you'll need to create a Date range

FRDateRange *range = [FRDateRange dateRangeWithStartDate:[NSDate distantPast] endDate:[NSDate futureDate]];

Once you've got that range you can few different things like:

Discover if a date is within that range.

if ([range isDateInRange:otherDate]) {
  //
}

Get the duration of the range.

NSTimeInterval length = [range duration];

Get a predicate for the range, useful with working with CoreData or collections.

[range predicateWithKeyPath:keyPathOfYourObject]

Get the next period using the same date range duration.

FRDateRange *nextRange = [range dateRangeForNextPeriod];

FRDateRange *previousRange = [range dateRangeForPreviousPeriod];

Move the date range "window" forward (or backward using negative values) by years or months.

FRDateRange *advancedRanage = [range dateRangeByAdvancedByMonths:1];

Get in Contact

Twitter Email