Search code examples
iosswiftdate

SwiftDate’s DateInRegion quarter is always 0


I’m trying to get the quarter of the year for a date but always getting a zero value when using the .quarter property. Is this a known issue or am I doing something incorrectly?

Sample Code using SwiftDate 5.x:

SwiftDate.defaultRegion = Region.current
let today = DateInRegion()
print(“Quarter = \(today.quarter)”)

Solution

  • This got addressed in v5.0.9 of the SwiftDate library.

    https://github.com/malcommac/SwiftDate/issues/585