Skip to content

Releases: malcommac/SwiftDate

SwiftDate 4.1.6

06 Jul 20:16
Compare
Choose a tag to compare

New Features

Fixes

  • #445 Fixed an issue which causes wrong results while using algebra operations with time components.

SwiftDate 4.1.2

08 May 22:07
Compare
Choose a tag to compare

New Features

  • #423 Added firstWeekday to Region struct. This allows you to easily change the first day of a week on given Region's Calendar object. By default the value is set sunday.

Fixes

  • #425 Fixed an issue with .dates(between:and) which sometimes may report as final date of the output array date greater than specified end date.
  • #417 Fixed an issue with colloquial functions which return wrong results when differences can be expressed in days.
  • #419 Fixed an issue with colloquial functions which return wrong results when differences can be expressed in days.
  • #427 Fixed an issue with .NET date parser (it now accounts timezone correctly and parser did not fail with < 1970 dates)

SwiftDate 4.1.1

06 Apr 18:21
Compare
Choose a tag to compare

New Features

  • #408 Date and DateInRegion has now two functions to round a date to certain interval (expressed in seconds or minutes). DateInRegion exposes roundAt() which directly modify the date itself; Date, as immutable object, exposes the same feature in roundedAt() function (which return a new Date instances).
  • #414 Added Daylight Saving Time functions: .isDST in DateInRegion (it returns true if the date uses daylight saving time); .DSTOffset in DateInRegion (it returns the value (in seconds) of the daylight saving time offset of the represented date), . nextDSTTransitionDate in DateInRegion (it returns the next daylight saving time transition after currently represented date when expressed); nextDSTTransitionDate() func in Date (it returns the next dst transition date when receiver is expressed in a particular timezone); DSTOffset() func in Date (it returns the offset of daylight saving time when receiver is expressed in a particular timezone); isDST() func in Date (it returns if receiver date uses daylight saving time when expressed in a particular timezone).

Fixes

  • #410 Several fixes while parsing less common ISO8601 formats (weeks only w/wo implicit year/month/day).
  • #411 Parsing an ISO8601 string now results in a DateInRegion which contains the correct timezone defined (Date instances are now converted automatically to be time-independent).
  • #412 Updated Unit Tests to become compatible with the new APIs changes. All tests now passes.
  • #409 Fixed an issue converting a difference between two dates when its more than 24 hours, but less than 48 hours (incorrectly the colloquial values returns 'yesterday')
  • #413 Single framework target in XCode Project (iOS, macOS, tvOS and watchOS)

SwiftDate 4.1.0

31 Mar 18:37
Compare
Choose a tag to compare

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.

SwiftDate 4.0.14

31 Mar 18:33
Compare
Choose a tag to compare

#404 Compatibility with Swift 3.1

SwiftDate 4.0.13

12 Feb 10:35
Compare
Choose a tag to compare

New Features

  • #384 Added Arabic translation (thanks to @abdualrhmanIO)
  • #356 Added a new formatter option called strict. Using strict instead of custom disable heuristics date guessing of the formatter (ie. 1999-02-31 become an invalid date to parse, while with heuristics enabled guessing date 1999-03-03 is returned instead).

SwiftDate 4.0.12

31 Jan 09:04
Compare
Choose a tag to compare

Fixes

  • #372 Fix for Local.collatorIdentifier (Returns zh-hans-CN and zh-hant-CN)
  • #374 DateZeroBehavior options are now public outside the library

New Features

  • #379 Added Hebrew translation (thanks to @ilandbt)
  • #376 Added Swedish translation (thanks to @traneHead)
  • #381 Replaced useImminentInterval in DateInRegionFormatter with a configurable value called imminentInterval. With a default value of 5 it fallback to just now version. If nil fallback is disabled.
  • #380 DateInRegionFormatter is now able to load custom localization both from LocaleName and custom .strings files (just set the formatter.localization = Localization(path: [PATH_TO_YOUR_STRINGS_FILE])

4.0.11

08 Jan 17:21
Compare
Choose a tag to compare

Fixes

  • #370 Cannot format colloquial date when a time component value is zero and allowedComponents does not contains lower time components (ie. cannot print "today" when set formatter to accept only allowedComponents = [.day] and day difference between dates is zero).
  • #371 DateInRegionFormatter crashes with any non-default .allowedComponents.

New Features

  • #365 Brazilian Portuguese support (thanks to @ipedro)

SwiftDate 4.0.8

30 Nov 13:36
Compare
Choose a tag to compare

New Features

  • #214, Added .next(day:) both for Date and DateInRegion to get the next weekday (ie. "next friday from today") after specified date.
  • #310 Added static func .dates(between:and:increment:) both for Date and DateInRegion which allows to enumerate dates between two interval with given increment in term of DateComponents.
  • #337 DateComponents now implements .in() func you can use to express an interval (like using TimeInterval) in terms of other time units (for example let x = 120.seconds.in(.minute) will return 2 minutes).
  • #348 DateComponents can now be merged using && operator. So if you have A = 1.hours, 3.minutes, 2.seconds and B = 1.year, 40.minutes, using let C = A && B you will get a new DateComponents instance with: C = 1.year, 1.hours, 43.minutes, 2.seconds.
  • #340, #320 Added Spanish support (thanks to @Sepho and @adrimarti).
  • #323, Added Korean support (thanks to @KisukPark).
  • #328, Added Slovak support (thanks to @beretis).
  • #329, Added Danish support (thanks to @emilpedersen).
  • #331, Added Czech support (thanks to @rbukovansky).
  • #187, Added .startWeek (get the first day of the sender's week) and .endWeek (get the last day of the sender's week) both for Date and DateInRegion

Fixes:

  • #344 .inDateDefaultRegion() is also used as standard value for region in .add() function of the Date object
  • #339 Fixed an issue with reverse interval fatal error when subtracting two dates
  • #317 Fixed an issue with language transations. Now all translations are specified in term of language+region settings (ie. en-US and not only en). All translation files were updated to reflect this new behaviour.
  • #346 Workaround to fix a rounding problem when comparing two Date or DateInRegion in terms of .nanosecond granularity. Now the comparision result is correct.
  • #315, Fixed an issue with Date().add(components:) and daylight saving dates.
  • #319, Added missing translation for german loc (thanks to @jaweinkauff)

SwiftDate 4.0.7

24 Oct 11:06
Compare
Choose a tag to compare
  • #306 Fixed a date ordering issue with time interval
  • #308 Added singular component for .year,.month,.day,.hour,.minute,.second time components
  • #309 Added Traditional Chinese support (thanks to @rynecheow)
  • #314 Restored French translation strings