Releases: malcommac/SwiftDate
SwiftDate 5.0.2
SwiftDate 5.0.1
Changes:
- #553 Methods
isAfterDate
,isBeforeDate
fromDate+Compare
extension ignoresorEqual
argument
SwiftDate 5.0.0
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 toSwiftDate.defaultRegion
and you can both read and set it.Date.setDefaultRegion(:)
was removed; useSwiftDate.defaultRegion
's setter.TimeZoneName
is nowZones
and its conform to the newZonesConvertible
protocol. All parameters (likeRegion
inits function) takes now a genericZonesConvertible
instance: this mean you can pass one of the enum values of the zone or just an instance ofTimeZone
object (or you can conform your own class to it).CalendarName
is nowCalendars
and its conform to the newCalendarConvertible
protocol. All parameters (likeRegion
inits function) takes now a genericCalendarConvertible
instance: this mean you can pass one of the enum values of the zone or just an instance ofCalendar
object (or you can conform your own class to it).LocaleName
is nowLocales
and its conform to the newLocaleConvertible
protocol. All parameters (likeRegion
inits function) takes now a genericLocaleConvertible
instance: this mean you can pass one of the enum values of the zone or just an instance ofCalendar
object (or you can conform your own class to it).Date/DateInRegion
:isBetween()
function was renamedisInRange()
Date/DateInRegion
:isAfter()
was renamed toisAfterDate()
Date/DateInRegion
:isBefore()
was renamed toisBeforeDate()
String
extension methodsdate(format:fromRegion)
anddate(formats:fromRegion)
are now replaced bytoDate(_:region)
(while similar shortcuts methods are added to parse common formats:toISODate()
,toDotNETDate()
,toRSSDate()
andtoSQLDate()
.- Removed
Int
extensionsecond,minute,hour,day,week,month,year
due to inconsistence (use plurar versionsseconds,minutes
etc. - Related dates generation is now grouped under the
dateAt()
function as enum list. ThereforenextWeekend
, `previo DateInRegion
:roundedAt()
is now replaced bydateRoundedAt()
which now compacts paramters in a single enum.DateInRegion
:startOf()
andendOf()
are now replaced bydateAtStartOf()
anddateAtEndOf()
and include support for both single and multiple units.DateInRegion
:atTime()
is now replaced bydateBySet(hour:min:secs:options)
DateInRegion
:DateInRegion
's staticdistantFuture()
anddistantPast
are nowfuture()
andpast()
DateInRegion
:next(day:)
is now part of thedateAt()
function with enum.weekday(_)
.DateInRegion
:add(components:)
is now replaced bydateByAdding(_:_:)
DateInRegion
:at(unit:value:)
andat(values:keep:)
are now replaced bydateBySet()
.nextDSTTransitionDate
property is now part of the enum ofdateAt()
recentDate()
andoldestDate()
are now callednewestIn()
andoldestIn()
TimeInterval
Extension:in(_:toDate:of:)
is now replaced bytoUnits(_:from:)
TimeInterval
Extension:string()
is now replaced bytoString()
DateTimeInterval
class is now replaced byTimePeriod
class and its descendantsDateInRegion
:dates(between:and:increment:)
to enumerate dates is now replaced byenumerateDates(from:to:increment:)
DateInRegion
: colloquial formattercolloquial(toDate:options:)
is now replaced bytoRelative(since:style:locale:)
- Formatting method
iso8601()
is nowtoISO8601()
and other methodsto..()
was added to simplify formatting task. Date/DateInRegion
: IntroducedcompareCloseTo()
to compare two dates against a precision value.- Added several shortcut methods as extensions of
String
to parse dates:toISODate()
,toDotNETDate()
,toRSSDate()
andtoSQLDate()
. - Comparison methods are now grouped by
compare()
function and a list of all available enums.
SwiftDate 4.5.0 - Swift 4
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 ofTimeInterval
. 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
Release Date: 2017-11-26
Zipped Version: Download 4.4.2
SwiftDate 4.4.1 - (Swift 4.x)
- #483 Fixes a minor issue with
NSRange
under XCode 9
SwiftDate 4.4.0 - First Swift 4.x compatible version
-
Release Date: 2017-09-14
-
Zipped Version for Swift 4: Download 4.4.0
-
#480 Fix for '-' operator both in
Date
andDateInRegion
classes where the result is correctly reported.
SwiftDate 4.3.0 - Latest Swift 3.x release
-
Release Date: 2017-09-14
-
Zipped Version for Swift 3: Download 4.3.0
-
#480 Fix for '-' operator both in
Date
andDateInRegion
classes where the result is correctly reported.
SwiftDate 4.1.11
- Release Date: 2017-09-05
- Zipped Version: Download 4.1.11
Changes:
- #479 Disabled LLVM instrumentation flag to allow AppStore submitting (more info https://forums.developer.apple.com/thread/81893)
SwiftDate 4.1.10
- Release Date: 2017-09-03
- Zipped Version: Download 4.1.10
Changelog:
- #472
CalendarName
now supportsRawRepresentable
protocol - #459 Fixed an issue with translation of Dutch locale
- #463
colloquial...()
functions now fallback totimeComponents...
functions whenstyle
is set to an abbreviated form (ie to return1h
) - #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)