I'm getting a warning from SwiftDate "[SwiftDate] Using .in() to extract calendar specific components without a reference date may return wrong values." How can I get rid of this warning?
My code:
let calendar = Calendar.current
let birthDate = calendar.date(from: calendar.dateComponents([.year, .month, .day], from: myBirthday))!
let dateToday = calendar.date(from: calendar.dateComponents([.year, .month, .day], from: Date()))!
let daysAlive = (dateToday - birthDate).in(.day)
That is the point where the warning occurs.
Thanks to Nick DiZazzo... change the last line of the code to: