Latest 3.0.0
Homepage https://github.com/ello/TimeAgoInWords
License MIT
Platforms ios 8.0, osx 10.9, tvos 9.0, watchos 2.0
Frameworks Foundation
Authors ,

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.

Latest podspec

{
    "name": "TimeAgoInWords",
    "version": "3.0.0",
    "summary": "A port of rails' time_ago_in_words date method.",
    "description": "This is a direct port of: http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-distance_of_time_in_words",
    "homepage": "https://github.com/ello/TimeAgoInWords",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": [
        "Ello",
        "Ryan Boyajian"
    ],
    "source": {
        "git": "https://github.com/ello/TimeAgoInWords.git",
        "tag": "3.0.0"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "tvos": "9.0",
        "watchos": "2.0"
    },
    "requires_arc": false,
    "source_files": "TimeAgoInWords.swift",
    "frameworks": "Foundation",
    "ios": {
        "resource_bundles": {
            "TimeAgoInWords": [
                "Localization/*.lproj"
            ]
        }
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This