Swiftpack.co - Package - Blackjacx/SHDateFormatter

SHDateFormatter

Build Status Github Current Release Cocoapods Platforms Xcode 10.0+ iOS 9.0+ Swift 4.2+ Github Repo Size Github Code Size Github Closed PR's License Codecov codebeat badge Downloads Donate

This framework supports encoding as well as decoding many different date and time format. At the moment the follownig are supported (see SHDateFormat):

  • shortWeekdayName => Sun, Mon, Tue, ...
  • longWeekdayName => Sunday, Monday, Tuesday, ...
  • shortTimeNoDate => 12:00 PM, 1:00 AM
  • noTimeShortDateNoYear => 12/31
  • noTimeShortDate => 12/02/2018
  • noTimeLongDate => December 2, 2018
  • noTimeRelativeDate => Today, Tomorrow, ...
  • ISO8601 => "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"

The ISO8601 format implements the standard for working with dates and times between client and server applications. A good explanation if this standard and how to work with it can be found in the Apple Documenation or on Ole Begemanns Blog.

Additionally the following convenience functions are available on the SHDateFormatter sharedInstance which will return default values if the input date is nil. They allow to easily deal with optionals and can provide additional functionality like giving you a relative date instead of e.g. "yyyy/MM/dd":

  • localizedTimeStringFromDate(_:) - will return --:-- per default
  • ... to be continued ...

Requirements

The framework is compatible with Xcode 9 and Swift 4. The minimum version is iOS 8.

Installation

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

pod 'SHDateFormatter'

Next Steps

  • include more convenience functions to better support relative dates
  • tests for string2date conversion
  • support swift package manager and carthage

Contribution

  • If you found a bug, please open an issue.
  • If you have a feature request, please open an issue.
  • If you want to contribute, please submit a pull request.

Author

Stefan Herold@Blackjacxxx

License

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

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

1.2.0 - Sep 27, 2018

  • #9: Swift 4.2 Migration - @blackjacx.
  • Restructured folder structure so pod try works

1.1.1 - Jun 22, 2018

1.1.0 - Jun 22, 2018

  • #7: Allow Relative Formatting For All SHDateFormats - @blackjacx.

1.0.3 - Feb 26, 2018

  • #5: Improve Robustness By Using Apple's Default Formatting Styles - @blackjacx.

1.0.2 - Oct 10, 2017

Changed

  • Refactor project structure