Skip to content

SwiftDate 4.1.0

Compare
Choose a tag to compare
@malcommac malcommac released this 31 Mar 18:37
· 599 commits to master since this release

SwiftDate 4.1.0


New Features

  • #402 Added Greek localization (thanks to @dimmdesign)

  • #399 colloquialSinceNow also allows to set unitsStyle params to specify the type of values you want to print.

  • #400 DateInRegion has a class func named date(formats:fromRegion) which allows parsing a single string with multiple formats (the first one that succeeds returns the instance of the DateInRegion). Also available as String extension (with the same name).

  • #223 ISO8601DateTimeFormatter now recognize the timezone of an ISO string and create a date with the correct value.

  • #407 SwiftDate now can parse ISO8601 strings without specifyng the ISO format; it evaluates the best format automatically. Also the parser faster than the previous built one. Since now .iso8601 parsing format is used only as formatter (from date to string, viceversa any given value is ignored. You are encouraged to use .iso8601Auto instead).

    The following ISO8601 variants are supported:

YYYYMMDD
YYYY-MM-DD
YYYY-MM
YYYY
YY //century 
//Implied century: YY is 00-99
YYMMDD
YY-MM-DD
-YYMM
-YY-MM
-YY
//Implied year
--MMDD
--MM-DD
--MM
//Implied year and month
---DD
//Ordinal dates: DDD is the number of the day in the year (1-366)
YYYYDDD
YYYY-DDD
YYDDD
YY-DDD
-DDD
//Week-based dates: ww is the number of the week, and d is the number (1-7) of the day in the week
yyyyWwwd
yyyy-Www-d
yyyyWww
yyyy-Www
yyWwwd
yy-Www-d
yyWww
yy-Www
//Year of the implied decade
-yWwwd
-y-Www-d
-yWww
-y-Www
//Week and day of implied year
-Wwwd
-Www-d
//Week only of implied year
-Www
//Day only of implied week
-W-d

Fixes

  • #405 Fixed some translation issues in Swedish (thanks to @deville)
  • #368 Deprecated at(unitsWithValues dict: [Calendar.Component : Int]) in Date and DateInRegion and replaced with functional at(values: [Calendar.Component : Int], keep: Set<Calendar.Component>)
  • #392 Fixed an issue with report negative interval when making operation with dates a and b where a - b < 0 iff a < b.
  • #397 Fixed an issue with colloquial func which report wrong difference of 1 day when two dates are distant < 24h but in two different days.