GitHub - malcommac/SwiftDate: All you need to have fun with Dates in Swift
source link: https://github.com/malcommac/SwiftDate
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
★★ Star me to follow the project! ★★
Created and maintaned by Daniele Margutti - www.danielemargutti.com
What's SwiftDate?
SwiftDate is the definitive toolchain to manipulate and display dates and time zones on all Apple platform and even on Linux and Swift Server Side frameworks like Vapor or Kitura.
★★ Over 3M of downloads on CocoaPods ★★
Features Highlights
From simple date manipulation to complex business logic SwiftDate maybe the right choice for your next project.
- Easy Date Parsing (custom formats, iso8601, rss & many more)
- Easy Date Formatting even with colloquial formatter and 140+ supported languages
- Easy math operations with time units (
2.hours + 5.minutes
...) - Intuitive components extraction (
day, hour, nearestHour, weekdayNameShort
etc.) - Derivated dates generation (
nextWeek, nextMonth, nextWeekday, tomorrow
...) - Over 20+ fine grained date comparison functions (
isToday, isTomorrow, isSameWeek, isNextYear
...) - Swift 4's Codable Support
- Random dates generation
- Fine grained date enumeration functions
- Time period support
- Convert TimeIntervals to other units (
2.hours.toUnits(.minutes)
)
and of course...
- IT'S TESTED!. As 5.0.0 the project has 90% of code coverage (want help us? write some unit tests and make a PR)
- IT'S FULLY DOCUMENTED!, both with a complete guide and with Jazzy!
- WE LOVE PLAYGROUND! Check out our interative playground!
Start with SwiftDate
- Current Version: 5.0.0
- Last Update: July 3, 2018
- Code Coverage: ~90%
The entire library is fully documented both via XCode method inspector and a complete markdown documentation you can found below.
- → Read the Documentation (updated as 5.0.0)
- → Requirements, Install, License & More
- → Upgrading from SwiftDate 4
Explore SwiftDate
From simple date manipulation to complex business logic SwiftDate maybe the right choice for your next project.
Let me show to you the main features of the library:
- Date Parsing
- Date Manipulation
- Date Comparsion
- Date Creation with Region (Timezone, Calendar & Locale)
- Derivated Dates
- Components Extraction
- Switch between timezones/locale and calendars
- Date Formatting
- Relative Date Formatting (fully customizable!)
- Codable Support
- Time Periods
1. Date Parsing
2. Date Manipulation
3. Date Comparison
Comparison is also available via standard math operators like (>, >=, <, <=
).
4. Date Creation with Region (Timezone, Calendar & Locale)
5. Derivated Dates
6. Components Extraction
7. Switch between timezones/locale and calendars
8. Date Formatting
Date formatting is easy, you can specify your own format, locale or use any of the provided ones.
9. Relative Date Formatting (fully customizable!)
10. Codable Support
11. Time Periods
SwiftDate integrates the great Matthew York's DateTools module in order to support Time Periods.
See Time Periods section of the documentation.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK