0

Adding number of days to a date, and I would round up to midnight. How is it possible in Swift?

guard let expirationDate = Calendar.current.date(byAdding: .day, value: expirationDays, to: p.createdAt!) else {
    return false
}
János
  • 29,667
  • 30
  • 151
  • 300
  • 1
    Have a look at the [Calendar.startOfDay(for:)](https://developer.apple.com/documentation/foundation/calendar/2293783-startofday) method. – Dávid Pásztor May 30 '22 at 08:17

0 Answers0