WIP
This commit is contained in:
@@ -37,3 +37,22 @@ extension Date {
|
||||
return isoFormatter.string(from: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
var dateFromServerDate: Date? {
|
||||
let df = DateFormatter()
|
||||
df.dateFormat = "yyyy-MM-dd'T'HH:mm:ssX"
|
||||
df.locale = Locale(identifier: "en_US_POSIX")
|
||||
return df.date(from: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension Date {
|
||||
func get(_ components: Calendar.Component..., calendar: Calendar = Calendar.current) -> DateComponents {
|
||||
return calendar.dateComponents(Set(components), from: self)
|
||||
}
|
||||
|
||||
func get(_ component: Calendar.Component, calendar: Calendar = Calendar.current) -> Int {
|
||||
return calendar.component(component, from: self)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user