Latest 1.0.1
Homepage https://github.com/Midhun-MP/Past
License MIT
Platforms ios 9.0
Authors

NSDate extension for easily getting the difference between two dates in terms of Year, Month, Week, Day, Hour, Minute and Second

Cocoapod

pod 'Past'

In Swift use import Past and in Objective-C use #import <Past/Past-Swift.h> for importing the library.

Constants

enum PastOptions : Int
{
    case Seconds
    case Minutes
    case Hours
    case Days
    case Weeks
    case Months
    case Years

    static let AllValues = [Seconds, Minutes, Hours, Days, Weeks, Months, Years]
}

Defines in which type the result should be given (Whether the difference should be given in terms of seconds or minutes or etc)

Available Methods

  • isToday() -> Bool

    Checks whether the date is today or not

  • isYesterday() -> Bool

    Checks whether the date was yesterday or not

  • isThisWeek() -> Bool

    Checks whether the date is in this current week or not

  • isLastWeek() -> Bool

    Checks whether the date was in last week or not

  • isThisMonth() -> Bool

    Checks whether the date is in this current month or not

  • isLastMonth() -> Bool

    Checks whether the date was in the last month or not

  • isThisYear() -> Bool

    Checks whether the date is in this year or not

  • isLastYear() -> Bool

    Checks whether the date was in last year or not

  • getMoment(inTermsOf option : PastOptions) -> String

    Returns a formatted moment in terms of passed past option. If the date is two days ago and the passed option is `Days` then the result will be 2 days ago

  • getElapsedSeconds() -> Int

    Returns the elapsed seconds

  • getElapsedMinutes() -> Int

    Returns the elapsed minutes

  • getElapsedHours() -> Int

    Returns the elapsed hours

  • getElapsedDays() -> Int

    Returns the elapsed days

  • getElapsedWeeks() -> Int

    Returns the elapsed weeks

  • getElapsedMonths() -> Int

    Returns the elapsed months

  • getElapsedYears() -> Int

    Returns the elapsed years

Latest podspec

{
    "name": "Past",
    "version": "1.0.1",
    "summary": "A simple NSDate extension for easily getting the difference between two dates",
    "description": "NSDate extension for easily getting the difference between two dates in terms of Year, Month, Week, Day, Hour, Minute and Second",
    "homepage": "https://github.com/Midhun-MP/Past",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Midhun MP": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/Midhun-MP/Past.git",
        "tag": "1.0.1"
    },
    "source_files": [
        "Past",
        "Past/**/*.{h,m,swift}"
    ],
    "exclude_files": "Past/Exclude"
}

Pin It on Pinterest

Share This