Latest 0.2.1
Homepage https://github.com/dknomura/DNTimeAndDay
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

A simple/swifty take on NSDate/NSDateFormatter/NSDateComponent. A DNTimeAndDay object can be initialized with a string value, int value, or date object. The object returns a stringValue in various formats and changes the time and day at a given interval. Only supports Time and Day of the Week at the moment

Installation

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

pod "DNTimeAndDay"

Example

To run the example project, clone the repo,

git clone https://github.com/dknomura/DNTimeAndDay.git

and run

pod install

from the Example directory.

Usage

var currentTimeAndDay = DNTimeAndDay.currentTimeAndDay()  
// can also init with string and int values
// day string parameter is case insensitive and can recognize common day abbreviations, time string can have a period or colon and the option of am/pm (ie "11:30p", "11.5p", "11:00pm", "23.5", "23:30" are all the same) 
// default minuteInterval = 30, dayInterval = 1
var otherTimeAndDay = DNTimeAndDay.init(dayString: "m", timeString:"9p", minuteInterval: 90, dayInterval = 2)

otherTimeAndDay.increaseTime()  
otherTimeAndDay.time.stringValue(forFormat:.format12Hour)  // "10:30pm"
// if the time is in between intervals, then the minute will increase to match the interval. 
// ie time = 12:00pm, not 12;15pm

currentTimeAndDay.increaseDay() 
currentTimeAndDay.day.stringValue(forFormat:.abbr) // "Wed"

Requirements

  • iOS 9.3+
  • Xcode 7.3.1+

Author

dnomnom, [email protected]

License

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

Latest podspec

{
    "name": "DNTimeAndDay",
    "version": "0.2.1",
    "summary": "A model struct to iterate through the time and day at a given interval.",
    "description": "A simple/swifty take on NSDate/NSDateFormatter/NSDateComponent. A DNTimeAndDay object can be initialized with a string value, int value, or date object. The object returns a stringValue in various formats and changes the time and day at a given interval. Only supports Time and Day of the Week at the moment",
    "homepage": "https://github.com/dknomura/DNTimeAndDay",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "dnomnom": "[email protected]"
    },
    "source": {
        "git": "https://github.com/dknomura/DNTimeAndDay.git",
        "tag": "0.2.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "DNTimeAndDay/Classes/**/*"
}

Pin It on Pinterest

Share This