SHDateFormatter

1.6.0

A date formatter supporting encoding as well as decoding of many different date and time formats including the often used ISO8601 standard.
Blackjacx/SHDateFormatter

What's New

1.6.0

2020-08-11T13:24:28Z
  • Add month year combined formatting - @blackjacx.

SHDateFormatter

CI status Github Current Release Cocoapods Platforms Xcode 11.0+ iOS 9.0+ Swift 5.2+ Github Repo Size Github Code Size Github Closed PR's License codebeat badge Twitter Follow Donate

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

  • shortWeekday => Sun, Mon, Tue, ...
  • longWeekday => Sunday, Monday, Tuesday, ...
  • shortMonth => Jan, Feb, ...
  • longMonth => January, February, ...
  • shortTimeNoDate => 12:00 PM, 1:00 AM
  • shortTimeMediumDate => Jan 1, 2000 at 12: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 ...

Installation

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

pod 'SHDateFormatter'

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

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

Description

  • Swift Tools 5.1.0

Dependencies

  • None
Last updated: Fri Apr 09 2021 22:07:51 GMT-0500 (GMT-05:00)