Today 1.1.0

Today 1.1.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release May 2018
SwiftSwift Version 4.0
SPMSupports SPM

Maintained by Meniny.



Today 1.1.0

  • By
  • Elias Abel

Today

What’s this?

Today is a tiny library to make using Date easier. Written in Swift.

Requirements

  • iOS 8.0+
  • macOS 10.10+
  • watchOS 2.0+
  • tvOS 9.0+
  • Xcode 8 with Swift 3

Contribution

You are welcome to fork and submit pull requests.

License

Today is open-sourced software, licensed under the MIT license.

Sample

import Today

func test() {
  let now = Date()
  print("now: \(now)")
  print("now.isToday: \(now.isToday)")
  print("now.isWeekend: \(now.isWeekend)")
  print("now is: \(now.weekdayName.name)")

  let nextDay = now.adding(days: 1)
  print("nextDay: \(nextDay)")
  print("nextDay.isTomorrow: \(nextDay.isTomorrow)")

  let later = Today.compare(date: nextDay, ifLater: now)
  print("nextDay is isLaterThan now: \(later)")

  let todayInNextYear = Today.dateByAdding(1, of: .year, to: now)
  print("todayInNextYear: \(String(describing: todayInNextYear))")
}