-(NSDate *)beginningOfDay:(NSDate *)date { NSCalendar *cal = [NSCalendar currentCalendar]; NSDateComponents *components = [cal components:( NSMonthCalend
Calendar units should be thought of as intervals. As of iOS 10 Calendar has some nice methods for this
Calendar
let day = Calendar.autoupdatingCurrent.dateInterval(of: .day, for: Date()) day?.end day?.start
You can use the same method, to get the start/end of any calendar component (week/month/year etc)