mirror of
https://github.com/Mueller-Patrick/DHBW-Service-App.git
synced 2024-11-01 08:53:58 +00:00
19 lines
474 B
Swift
19 lines
474 B
Swift
|
//
|
||
|
// DateExtension.swift
|
||
|
// DHBW-Service
|
||
|
//
|
||
|
// Created by Patrick Müller on 07.04.21.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
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)
|
||
|
}
|
||
|
}
|