Skip to content
This repository

SexyDates is an Objective-C category on NSNumber that allows you to create dates (NSDate) in a sexy, Rails-/ActiveSupport-like way: `@(3).days.ago`.

branch: master

Add Cocoapods spec.

Update installation instructions.
latest commit 31bc736b74
Dominique d'Argent authored
Octocat-spinner-32 .gitignore Initial commit
Octocat-spinner-32 LICENSE Add license file (MIT).
Octocat-spinner-32 NSNumber+SexyDates.h Rewrite internals.
Octocat-spinner-32 NSNumber+SexyDates.m Rewrite internals.
Octocat-spinner-32 README.md Add Cocoapods spec.
Octocat-spinner-32 SexyDates.h Add entry point header.
Octocat-spinner-32 SexyDates.podspec Add Cocoapods spec.
README.md

SexyDates

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

Installation

CocoaPods

pod 'SexyDates'

Manual

Copy SexyDates.h, NSNumber+SexyDates.{h,m} into your project.

Usage examples

Sexy version:

@(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

Long version:

[[@(1) minute] fromNow] // In a minute
[[@(4) weeks] since:[[@(1) day] fromNow]] // Tomorrow in 4 weeks

Longest version:

[[[NSNumber numberWithInteger:1] minute] fromNow] // In a minute

You get the idea…

License

SexyDates is released under the MIT license:

Copyright (c) <2013> <Dominique d'Argent>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Something went wrong with that request. Please try again.