SwiftyDate 2.0.0

SwiftyDate 2.0.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Sep 2016
SPMSupports SPM

Maintained by Eddie Kaiger.



  • By
  • Eddie Kaiger

SwiftyDate

SwiftyDate allows you to easily create relative NSDates in Swift.

It extends the Swift number types to allow you to create expressions like this:

let pastDate = 12.days.ago()
let futureDate = 7.weeks.fromNow()
let beforeDate = 5.minutes.before(anotherDate)
let afterDate = 15.hours.after(anotherDate)

Includes extensions for NSTimeInterval, Double, Int, Float, CGFloat, and NSNumber.

Time interval types:

  • seconds
  • minutes
  • hours
  • days
  • weeks

Functions to generate dates:

  • fromNow()
  • ago()
  • after(date: NSDate)
  • before(date: NSDate)

Installation

CocoaPods

pod 'SwiftyDate'

Usage

import SwiftyDate


Original idea by my friend Joe.