Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 1.41 KB

README.md

File metadata and controls

44 lines (35 loc) · 1.41 KB

TimeAgoInWords

CI Status Version License Platform

This is a direct port of: http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-distance_of_time_in_words

Usage

To override the default strings you can update them before you access them:

let railsStrings = [
  "LessThan": "less than ",
  "About": "about ",
  "Over": "over ",
  "Almost": "almost ",
  "Seconds": " seconds",
  "Minute": " minute",
  "Minutes": " minutes",
  "Hour": " hour",
  "Hours": " hours",
  "Day": " day",
  "Days": " days",
  "Months": " months",
  "Years": " years",
]
TimeAgoInWordsStrings.updateStrings(railsStrings)
NSDate(timeIntervalSinceNow: -90).timeAgoInWords() // 2 minutes

Installation

TimeAgoInWords is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TimeAgoInWords"

License

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