Last Updated: February 25, 2016
·
841
· nubbel

Rails-like dates in Objective-C

SexyDates is an open source Objective-C category on NSNumber that allows you to create dates (NSDate objects) in a sexy, Rails-/ActiveSupport-like way.

Examples

#import "NSNumber+SexyDates.h"

@(1).minute.fromNow // In a minute
@(3).days.ago // Three days ago
[@(4).weeks since:@(1).day.fromNow] // Tomorrow in 4 weeks
[@(2).years until:@(1).day.ago] // Yesterday two years ago

Have fun!

2 Responses
Add your response

SexyDates indeed!

over 1 year ago ·

@alexcristea haha, glad you like it (at least the name) ;-).

over 1 year ago ·