Latest 1.0.0
Homepage https://github.com/tschmitz/DateIntervalOperators
License MIT
Platforms ios 8.0, osx 10.9, requires ARC
Authors

A set of extensions and operators for date arithmetic in Swift.

Usage

Date Components

Easily can create instances of NSDateComponents initialized to various intervals.

1.year()
// Equivalent to:
// let components = NSDateComponents()
// components.year = 1

5.years()
15.minutes()
1.month()

Supported intervals:

second(s)
minute(s)
hour(s)
day(s)
week(s)
month(s)
year(s)

Date Arithmetic

Add or subtract date intervals from instances of NSDate.

let today = NSDate()
today + 1.year()      // 1 year from now
today - 2 month()     // 2 months ago
today + 5.minutes()   // 5 minutes from now 

Installation

CocoaPods

You can also install this library using CocoaPods. Just add this line to your Podfile:

pod 'DateIntervalOperators'

Then import library module like so:

import DateIntervalOperators

Manual

You can also install this library manually by copying DateIntervalOperators.swift to your project.

Contributing

If you have comments, complaints or ideas for improvements, feel free to open an issue or a pull request.

Author and license

Tim Schmitz

DateIntervalOperators is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "DateIntervalOperators",
    "version": "1.0.0",
    "license": "MIT",
    "summary": "A set of extensions and operators for manipulating dates in Swift",
    "homepage": "https://github.com/tschmitz/DateIntervalOperators",
    "authors": {
        "Tim Schmitz": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tschmitz/DateIntervalOperators.git",
        "tag": "1.0.0"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "8.0",
        "osx": "10.9"
    },
    "source_files": "*.swift"
}

Pin It on Pinterest

Share This