[+] Create function date.added() to modify the date

This commit is contained in:
Hykilpikonna
2021-01-17 14:23:28 -05:00
parent fd332ad9f4
commit 3cc0672d26
+6
View File
@@ -53,4 +53,10 @@ extension Date
let comp = calendar.dateComponents([c], from: self)
return comp.value(for: c)!
}
/// Return a new modified date
func added(_ c: Calendar.Component, _ v: Int) -> Date
{
return Calendar.current.date(byAdding: c, value: v, to: self)!
}
}