|
|
|
|
@ -273,3 +273,15 @@ public extension Date { |
|
|
|
|
return calendar.date(bySetting: .minute, value: 0, of: self)!.withoutSeconds() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public extension Date { |
|
|
|
|
var startOfCurrentMonth: Date { |
|
|
|
|
let calendar = Calendar.current |
|
|
|
|
return calendar.dateInterval(of: .month, for: self)?.start ?? self |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func addingMonths(_ months: Int) -> Date { |
|
|
|
|
let calendar = Calendar.current |
|
|
|
|
return calendar.date(byAdding: .month, value: months, to: self) ?? self |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|