Skip to content

Releases: malcommac/SwiftDate

SwiftDate 5.0.2

12 Jul 08:06
Compare
Choose a tag to compare

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.1

05 Jul 19:29
Compare
Choose a tag to compare

Changes:

  • #553 Methods isAfterDate, isBeforeDate from Date+Compare extension ignores orEqual argument

SwiftDate 5.0.0

03 Jul 20:28
Compare
Choose a tag to compare

Upgrading from Swift 4.x

SwiftDate 5.x is a complete rewrite of the library. While it introduces several new features a great part of the work is about a consistent naming of the functions: some was renamed while deprecated ones was removed.

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.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
	SwiftDate.defaultRegion = Region.local // set region to local device attributes
	// ... do something else
	return true
}

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()
  • String extension methods date(format:fromRegion) and date(formats:fromRegion) are now replaced by toDate(_:region) (while similar shortcuts methods are added to parse common formats: toISODate(), toDotNETDate(), toRSSDate() and toSQLDate().
  • Removed Int extension second,minute,hour,day,week,month,year due to inconsistence (use plurar versions seconds,minutes etc.
  • Related dates generation is now grouped under the dateAt() function as enum list. Therefore nextWeekend, `previo
  • DateInRegion: roundedAt() is now replaced by dateRoundedAt() which now compacts paramters in a single enum.
  • DateInRegion: startOf() and endOf() are now replaced by dateAtStartOf() and dateAtEndOf()and include support for both single and multiple units.
  • DateInRegion: atTime() is now replaced by dateBySet(hour:min:secs:options)
  • DateInRegion: DateInRegion's static distantFuture() and distantPast are now future() and past()
  • DateInRegion:next(day:) is now part of the dateAt() function with enum .weekday(_).
  • DateInRegion: add(components:) is now replaced by dateByAdding(_:_:)
  • DateInRegion: at(unit:value:) and at(values:keep:) are now replaced by dateBySet().
  • nextDSTTransitionDate property is now part of the enum of dateAt()
  • recentDate() and oldestDate() are now called newestIn() and oldestIn()
  • TimeInterval Extension: in(_:toDate:of:) is now replaced by toUnits(_:from:)
  • TimeInterval Extension: string() is now replaced by toString()
  • DateTimeInterval class is now replaced by TimePeriod class and its descendants
  • DateInRegion: dates(between:and:increment:) to enumerate dates is now replaced by enumerateDates(from:to:increment:)
  • DateInRegion: colloquial formatter colloquial(toDate:options:) is now replaced by toRelative(since:style:locale:)
  • Formatting method iso8601() is now toISO8601() and other methods to..() was added to simplify formatting task.
  • Date/DateInRegion: Introduced compareCloseTo() to compare two dates against a precision value.
  • Added several shortcut methods as extensions of String to parse dates: toISODate(), toDotNETDate(), toRSSDate() and toSQLDate().
  • Comparison methods are now grouped by compare() function and a list of all available enums.

SwiftDate 4.5.0 - Swift 4

26 Nov 12:06
Compare
Choose a tag to compare

CHANGELOG

  • #495 Added Thai language (thanks to Thanakrit Weekhamchai)
  • #492 Introduced a new ColloquialDateFormatter class
  • #503 Added isBetween to check if a date is inside a given dates range with passed granularity.
  • #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 4

26 Oct 17:47
Compare
Choose a tag to compare

Release Date: 2017-11-26
Zipped Version: Download 4.4.2

  • #495 Added Persian language
  • #489 Disabled LLV Code Coverage scheme
  • #494 Removed String.characters warning from Swift 3.x
  • #487 Fixed a regression with rangeAt instead of range(at) from Swift 3.x)

SwiftDate 4.4.1 - (Swift 4.x)

15 Sep 06:01
Compare
Choose a tag to compare
  • #483 Fixes a minor issue with NSRange under XCode 9

SwiftDate 4.4.0 - First Swift 4.x compatible version

14 Sep 18:18
Compare
Choose a tag to compare
  • Release Date: 2017-09-14

  • Zipped Version for Swift 4: Download 4.4.0

  • #480 Fix for '-' operator both in Date and DateInRegion classes where the result is correctly reported.

  • #476 Added Russian translation thanks to roor

SwiftDate 4.3.0 - Latest Swift 3.x release

14 Sep 18:18
Compare
Choose a tag to compare
  • Release Date: 2017-09-14

  • Zipped Version for Swift 3: Download 4.3.0

  • #480 Fix for '-' operator both in Date and DateInRegion classes where the result is correctly reported.

  • #476 Added Russian translation thanks to roor

SwiftDate 4.1.11

05 Sep 21:16
Compare
Choose a tag to compare

Changes:

SwiftDate 4.1.10

03 Sep 18:32
Compare
Choose a tag to compare

Changelog:

  • #472 CalendarName now supports RawRepresentable protocol
  • #459 Fixed an issue with translation of Dutch locale
  • #463 colloquial...() functions now fallback to timeComponents... functions when style is set to an abbreviated form (ie to return 1h)
  • #464 Fixed unit tests for ISO8501
  • #461 Fixed translation for Slovak locale
  • #470 Added Azerbaijani Latin locale (thanks to @elshad)
  • #468 Fixed an issue with negative intervals in DateTimeInterval (regression from previous release)