malcommac/SwiftDate
🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
30 Releases
Latest: 3y ago
7.0.0Latest
📋 CHANGES
- Removed `RelativeTimeFormatter` and replaced with built-in system class
- Fixed compatibility issues on SPM
- This version require at least Swift 5.5, iOS 13+, macOS 10.15+, watchOS 6+, tvOS 13+.
SwiftDate 6.3.1 - (Swift 5.x+)6.3.1
📋 CHANGES
- #763 [FIX] Minimum deployment target for iOS is set to 9.0 and tvOS to 9 for Carthage builds
SwiftDate 6.3.0 - (Swift 5.x+)6.3.0
📋 CHANGES
- #753 [NEW]: Added added `.dateMixed` format options to `toString()` method to format dateTime with differing date and time styles.
- #751 [NEW]: Added support for SPM 5.3 and Package.swift to support Xcode 12 and iOS9+.
- #728 [NEW]: Added support Swift Package `.automatic`, `.static` and `.dynamic` linking support in order to share same package between multiple targets.
- #727 [NEW] Added `.asLocale()` to `String` object to transform identifier in an NSLocale objectS.
- #762 [FIX]: CocoaPods: Update podspec to iOS9 in order to fix Xcode 12 warning.
- #760 [FIX]: Minor fixes to documentation and updated to 6.3.0.
- #752 [FIX]: Avoid force unwrap in `sharedOrdinalNumberFormatter`.
SwiftDate 6.2.0 - (Swift 5.x+)6.2.0
📋 CHANGES
- [NEW #694] Added support forDate position between 2 dates range (positionInRange)
- [NEW #695] Added support for Swift Package Manager (SwiftPM) 5.1
- [NEW #742] Added support for non latin Serbian localization
- [FIX #749] Fixed a crash with force unwrap in TimeInterval+Formatter
- [FIX #726] Fixed date comparison using the .isSameMonth option
- [FIX #725] Fixed wrong timezone while setup a different SwiftDate.defaultRegion
- [FIX #710] Fixed grammar for Slovak translation
- [FIX #708] Fix typo in customFormatter of DataRepresentable
- + 2 more
SwiftDate 6.1.0 - (Swift 5.x+)6.1.0
📋 CHANGES
- #682 - [FIX] Fixed Japanese relative datetime formatting.
- #693 - [FIX] Fixed wrong result when subtracting `DateInRegion` dates.
- #676 - [NEW] Added `difference()` and `differences()` methods to get the difference between two dates expressed in variuous time components with respect to the other date as a positive integer.
- #676 - [NEW] Added `dateAt(dayOfMonth:monthNumber:yearNumber:)` method to returns the date on the given day of month preserving smaller components.
- #676 - [NEW] Added `dateAfter(weeks:on:)` method to returns the date after given number of weeks on the given day of week.
- #676 - [NEW] Added `next(:withWeekOfMonth:andMonthNumber:)` method to returns next date with the given weekday and the given week number.
- #676 - [NEW] Added `next(dayOfMonth:monthOfYear:)` method to returns the next day of month preserving smaller components (hour, minute, seconds).
SwiftDate 6.0.36.0.3
📋 CHANGES
- #670 [FIX] Fixed`toISODate()` which ignores explicitly passed `Region` instance. Now if region is passed it overrides any parsed timezone from ISO source string.
- #668 [FIX] Fixed missing zero padding with `toClock()` on the first digit.
- #652 [FIX] Resolved slow compiling times: moved `RelativeFormatter`'s languages files to json. This currently breaks Linux compatibility because SPM does not support bundled resources.
- #666 [NEW] Added `dateAt(weekdayOrdinal:weekday:monthNumber:yearNumber:)` `nextWeekday()` to both Date and DateInRegion
SwiftDate 6.0.26.0.2
📋 Changes
- #656 Fixed for `ISOFormatter` options `withoutTZSeparators` which produces empty string results if not paired with `withInternetDateTimeExtended`
- #653 `TimeInterval.ComponentsFormatterOptions` reverted to public visibility
- #635 Better handling for language fallback in relative date formatter
- #654 Fixed an issue when compiling library on Linux using `round` function (glib/darwin)
- #658 Fixed `httpFormat` format which are not valid for [Unicode Technical Reference #35](http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns)
SwiftDate 6.0.1 (Swift 5.0+)6.0.1
📋 Changes
- #650 Fixes for `RelativeFormatter.Style` visibility outside the library
SwiftDate 6.0.0 (Swift 5.0+)6.0.0
📋 Changes
- #648 Swift 5 / Xcode 10.2 Compatibility
- #642 Wrong `toISO()` output parsing date string from non Gregorian calendars
- #643 Parsing ISO-8601 formatted week dates fails
- #646 Relative date formatting never returns the "previous" value (now supports past/future/current)
- #638 Added `RoundingStrategy` for `RelativeFormatter.Gradation.Rule`
- #647 HTTP Header formatter fix
SwiftDate 5.1.0 (Swift 4.0+)5.1.0
📋 Changelog
- #622 Added enumeration methods to get dates for a specified weekday in a date range (see [3.12 section in documentation](https://github.com/malcommac/SwiftDate/blob/master/Documentation/3.Manipulate_Date.md#enumerateweekdays))
- #634 Added `Month` and `Year` structures with circular operation support (ie. you can remove two days from `monday` and you got `saturday` or add two months to `november` to get `january`). All of these structures along with `Weekday` support localized display of the represented value.
- #623 Fixed ambiguos operator error when subtracting a `Date` with `TimeInterval`
- #626 Fixed ISO 8601 output when current calendar is not Gregorian
- #627 Added `Asia/Saigon` in `Zones` enumeration
- #631 Fixed RealtiveFormtter's `toRelative()` methods when no quantifier is available
- #629 Fixed heuristic date guessing inside the formatter which prevents discovering wrong date
- #628 Fixed ISO8601 output when printing date along with complete time
- + 2 more
SwiftDate 5.0.135.0.13
📋 Changes
- #555 Deprecated `toString()` of `TimeInterval/Double` to use `toIntervalString()` (in order to avoid ambiguity)
- #611 Removed `arc4random_uniform` to use new Swift 4.2 random APIs
- #568 Add Linux support to SwiftDate ([see notices](https://github.com/malcommac/SwiftDate/blob/master/Documentation/0.Informations.md#linux) on documentation)
SwiftDate 5.0.125.0.12
📋 Changes
- #521 `weekdayName()`, `eraName()`, `quarterName()` allows to specify locale overwrite to region's locale
- #596 Refactoring for `hashValue` in `DateInRegion`, fixed compiler error on watchOS target
- #598 Silenced Xcode 'Conversion to Swift 4.2 is available' warning
- #608 Fixed crash when using `quarterName(.short)` with a Date in 4th quarter of the year
SwiftDate 5.0.115.0.11
📋 Changes
- #597 Differences between two dates as `DateComponents` via `componentsSince()` method in `DateInRegion`
- #602 Crash in `RelativeFormatter` when gradation was not found
- #606 Added `ms` parameter to `dateBySet()` function to alter the milliseconds value of a date
- #607 Fixed ambiguity for `toDate(_:region:)` with multiple formats bug
- #609 `isInRange` ignores granularity parameter when used with plain `Date`
SwiftDate 5.0.105.0.10
📋 Changes
- #594 Support for arm64_32 architecture in Xcode 10 for Carthage
SwiftDate 5.0.9 (Swift 4.2+)5.0.9
🐛 FIXES
- #592 Added `.calendar` and `.locale` property to configure `ComponentsFormatterOptions` struct to format `TimeInterval` values.
- #588 Fixed some links in Documentation files
- #585 Fixed .quarter property which return always a zero value
- #586 Fixed ISO8601 parser crash with certain string configurations
- #583 Fixed broken links in `Manipulate_Date.md` documentation file
- #582 Fixed `Decodable` support for `DateInRegion` and `compactMap()` function.
- #575 Fallback to language when language+region option for `toRelative()` function does not exists
- #573 Fixed `DateInRegion(milliseconds:)` init to work with actual milliseconds values
✨ ADDITIONS
- #574 Added customization via `ComponentsFormatterOptions` object in `toString()` of `TimeInterval` formatter (in addition to closure version of the same method)
SwiftDate 5.0.75.0.7
📋 Changes
- Added `toUnit()` to `TimeInterval` to extract single time component from an interval (as companion of `toUnits()`).
- Removed `calendar` argument from `toUnit()` and `toUnits()`. Value is taken from reference's date `region.calendar`
SwiftDate 5.0.65.0.6
📋 Changes
- #580 Restoring in() function for DateInRegion/Date/TimeInterval; added isInside() for Date/DateInRegion
SwiftDate 5.0.55.0.5
📋 Changes
- #561 Fixed incorrect `preWeek` and `nextWeek` calculation
SwiftDate 5.0.45.0.4
📋 Changes
- #559 Fixes for Decodable protocol in DateInRegion/Region on Swift 4.2
SwiftDate 5.0.35.0.3
📋 Changes
- #560 - Build failed 5.0.2 due to SwiftLint superfluous rules
SwiftDate 5.0.25.0.2
📦 Release Notes
- Release Date: 2018-07-12
- #557 Fixed Swift Package Manager (SPM) project structure
- #558 Added `ordinalDay` property to `Date` and `DateInRegion` (iOS 9+, macOS 10.11+)
- Fixes for SwiftLint linter
- Project converted to Swift 4.2
SwiftDate 5.0.15.0.1
📋 Changes:
- #553 Methods `isAfterDate`, `isBeforeDate` from `Date+Compare` extension ignores `orEqual` argument
SwiftDate 5.0.05.0.0
📦 Upgrading from Swift 4.x
- If you miss a features or you are interested in a new one create a new Issue.
📦 Important Note about Default Region
- In SwiftDate 4.x the default region is automatically set to local regiomn, where all attributes are set automatically to the current's device's locale, timezone and calendar.
- Since SwiftDate 5, in order to be more comply with `Date`'s default behaviour, the default region's timezone is set to GMT+0 (UTC).
- If you want to restore the old behaviour just set it to `Region.local` just after the launch of the app.
- ```swift
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
- SwiftDate.defaultRegion = Region.local // set region to local device attributes
- // ... do something else
- return true
- + 2 more
✨ Added/Removed/Replaced Methods
- `Date.defaultRegion` was renamed to `SwiftDate.defaultRegion` and you can both read and set it.
- `Date.setDefaultRegion(:)` was removed; use `SwiftDate.defaultRegion`'s setter.
- `TimeZoneName` is now `Zones` and its conform to the new `ZonesConvertible` protocol. All parameters (like `Region` inits function) takes now a generic `ZonesConvertible` instance: this mean you can pass one of the enum values of the zone or just an instance of `TimeZone` object (or you can conform your own class to it).
- `CalendarName` is now `Calendars` and its conform to the new `CalendarConvertible` protocol. All parameters (like `Region` inits function) takes now a generic `CalendarConvertible ` instance: this mean you can pass one of the enum values of the zone or just an instance of `Calendar` object (or you can conform your own class to it).
- `LocaleName` is now `Locales` and its conform to the new `LocaleConvertible` protocol. All parameters (like `Region` inits function) takes now a generic `LocaleConvertible ` instance: this mean you can pass one of the enum values of the zone or just an instance of `Calendar` object (or you can conform your own class to it).
- `Date/DateInRegion`: `isBetween()` function was renamed `isInRange()`
- `Date/DateInRegion`: `isAfter()` was renamed to `isAfterDate()`
- `Date/DateInRegion`: `isBefore()` was renamed to `isBeforeDate()`
- + 21 more
SwiftDate 4.5.0 - Swift 44.5.0
📋 CHANGELOG
- [#495](https://github.com/malcommac/SwiftDate/pull/495) Added Thai language (thanks to [Thanakrit Weekhamchai](https://github.com/dumbest))
- [#492](https://github.com/malcommac/SwiftDate/pull/492) Introduced a new `ColloquialDateFormatter` class
- [#503](https://github.com/malcommac/SwiftDate/pull/503) Added `isBetween` to check if a date is inside a given dates range with passed granularity.
- [#505](https://github.com/malcommac/SwiftDate/pull/505) Exposed reference date for `in()` function of `TimeInterval`. If specified conversion of the interval is aware of daylight saving time and calendar's specific dates; when not specified absolute conversion still available (only for `.day,.hour,.minute,.second` components).
SwiftDate 4.4.2 - Swift 44.4.2
📋 Changes
- [#495](https://github.com/malcommac/SwiftDate/pull/495) Added Persian language
- [#489](https://github.com/malcommac/SwiftDate/pull/489) Disabled LLV Code Coverage scheme
- [#494](https://github.com/malcommac/SwiftDate/pull/494) Removed `String.characters` warning from Swift 3.x
- [#487](https://github.com/malcommac/SwiftDate/pull/487) Fixed a regression with `rangeAt` instead of `range(at)` from Swift 3.x)
SwiftDate 4.4.1 - (Swift 4.x)4.4.1
📋 Changes
- [#483](https://github.com/malcommac/SwiftDate/issues/483) Fixes a minor issue with `NSRange` under XCode 9
SwiftDate 4.4.0 - First Swift 4.x compatible version4.4.0
📋 Changes
- Release Date: 2017-09-14
- Zipped Version for Swift 4: [Download 4.4.0](https://github.com/malcommac/SwiftDate/releases/tag/4.4.0)
- [#480](https://github.com/malcommac/SwiftDate/pull/480) Fix for '-' operator both in `Date` and `DateInRegion` classes where the result is correctly reported.
- [#476](https://github.com/malcommac/SwiftDate/pull/476) Added Russian translation thanks to [roor](https://github.com/roor)
SwiftDate 4.3.0 - Latest Swift 3.x release4.3.0
📋 Changes
- Release Date: 2017-09-14
- Zipped Version for Swift 3: [Download 4.3.0](https://github.com/malcommac/SwiftDate/releases/tag/4.3.0)
- [#480](https://github.com/malcommac/SwiftDate/pull/480) Fix for '-' operator both in `Date` and `DateInRegion` classes where the result is correctly reported.
- [#476](https://github.com/malcommac/SwiftDate/pull/476) Added Russian translation thanks to [roor](https://github.com/roor)
SwiftDate 4.1.114.1.11
📋 Changes
- Release Date: 2017-09-05
- Zipped Version: [Download 4.1.11](https://github.com/malcommac/SwiftDate/releases/tag/4.1.11)
- [#479](https://github.com/malcommac/SwiftDate/pull/479) Disabled LLVM instrumentation flag to allow AppStore submitting (more info [https://forums.developer.apple.com/thread/81893](https://forums.developer.apple.com/thread/81893))
SwiftDate 4.1.104.1.10
📋 Changes
- Release Date: 2017-09-03
- Zipped Version: [Download 4.1.10](https://github.com/malcommac/SwiftDate/releases/tag/4.1.10)
- [#472](https://github.com/malcommac/SwiftDate/pull/472) `CalendarName` now supports `RawRepresentable` protocol
- [#459](https://github.com/malcommac/SwiftDate/pull/459) Fixed an issue with translation of Dutch locale
- [#463](https://github.com/malcommac/SwiftDate/pull/463) `colloquial...()` functions now fallback to `timeComponents...` functions when `style` is set to an abbreviated form (ie to return `1h`)
- [#464](https://github.com/malcommac/SwiftDate/pull/464) Fixed unit tests for ISO8501
- [#461](https://github.com/malcommac/SwiftDate/pull/461) Fixed translation for Slovak locale
- [#470](https://github.com/malcommac/SwiftDate/pull/470) Added Azerbaijani Latin locale (thanks to [@elshad](https://github.com/Elshad))
- + 1 more
