Instantly share code, notes, and snippets.

Embed
What would you like to do?
// MARK: Private methods
private func locateCorrectFormat(for dateString: String) -> Date
{
if let foundDate = parse(dateString, using: DateFormats.basicDate)
{
return foundDate
}
else if let foundDate = parse(dateString, using: DateFormats.basicDateWithTime_With_Miliseconds)
{
return foundDate
}
else if let foundDate = parse(dateString, using: DateFormats.basicDateWithTime_Without_Miliseconds)
{
return foundDate
}
else if let foundDate = parse(dateString, using: DateFormats.basicDateWithTime_WithX_Miliseconds)
{
return foundDate
}
return useRegexToExtractDate(from: dateString)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment