I take advantage of nextDate(after:matching:matchingPolicy:repeatedTimePolicy:route:)
to seek for a date backwards.
I need to seek for the twenty third of the month earlier than, however I get a leap to from 2022 to 1995.
Is that this a bug or am I simply lacking one thing calendar-wise that makes this consequence truly right?
var calendar: Calendar = .autoupdatingCurrent
calendar.timeZone = TimeZone(identifier: "Europe/Stockholm")!
let date = Date(timeIntervalSince1970: 1666310400.0) // "Oct 21, 2022 at 2:00 AM"
print(date) // "2022-10-21 00:00:00 +0000n"
calendar.nextDate(after: date, // "Sep 23, 1995 at 12:00 AM" ??
matching: DateComponents(day: 23),
matchingPolicy: .previousTimePreservingSmallerComponents,
route: .backward)