import Foundation

extension Date {
    
    /// function for converting string to date
    /// - Parameter string: date representation in string
    /// - Returns: date object
    static func getDateFromString(string: String) -> Date {
        let datefromatter = DateFormatter()
        datefromatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss"
        guard let date = datefromatter.date(from: String(string.prefix(19))) else { return Date() }
        return date
    }
}
