Swiftpack.co - Blackjacx/SHDateFormatter as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Blackjacx.
Blackjacx/SHDateFormatter 1.7.1
A date formatter supporting encoding as well as decoding of many different date and time formats including the often used ISO8601 standard.
⭐️ 4
🕓 31 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/Blackjacx/SHDateFormatter.git", from: "1.7.1")

Twitter Follow Github Current Release Swift Package Manager Compatible Swift Versions Platforms Xcode 13+ Codebeat License Donate

SHDateFormatter

This framework supports encoding as well as decoding many different date and time format. At the moment the following 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'" / "yyyy'-'MM'-'dd'T'HH':'mm':'ss'+01:00'" / etc.

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

Swift Package Manager

In Xcode open your target list and select your project. Click the tab Swift Packages and there the small + icon. Enter the URL of this repository, select the version you want to install - usually the preset is okay - and confirm.

CocoaPods

I dropped CocoaPods support in favor of SPM from version 1.7.0. Please integrate the package via SPM (see above).

Carthage

I dropped Carthage support in favor of SPM from version 1.7.0. Please integrate the package via SPM (see above).

Code Documentation

The code documentation is generated and hosted by Swift Package Index (powered by DocC)

Release

To release this Swift package the following steps have to be taken:

  • Create a new branch release-x.y.z
  • Run bash <(curl -H -s https://raw.githubusercontent.com/Blackjacx/Scripts/master/frameworks/bootstrap.sh) to update to the latest shared development files
  • Run bundle update to update all Ruby gems
  • Commit all changes, make a PR and merge it to develop
  • Run bundle exec fastlane release framework:"SHDateFormatter" version:"x.y.z" to release the new version
  • Post the following on Twitter
SHDateFormatter release x.y.z 🎉

▸ 🚀  SHDateFormatter (x.y.z) successfully published
▸ 📅  September 2nd
▸ 🌎  https://swiftpackageindex.com/Blackjacx/SHDateFormatter
▸ 🌎  https://github.com/Blackjacx/SHDateFormatter/releases/latest
▸ 👍  Tell your friends!

#SPM #Date #Formatter #tested

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

Contributors

Thanks to all of you who are part of this:

License

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

GitHub

link
Stars: 4
Last commit: 31 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Add new format `MM yy`
31 weeks ago

What's Changed

New Contributors

Full Changelog: https://github.com/Blackjacx/SHDateFormatter/compare/1.7.0...1.7.1

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics