Skip to content

Commit

Permalink
docs: correct Date serialization example
Browse files Browse the repository at this point in the history
It was missing the `validate` function. In addition, the `dateFormat` was just wrong. Not sure if that was a breaking change in Swift from years ago or if it just was never correct. 🤷🏻
  • Loading branch information
drmohundro authored Jan 6, 2022
1 parent 4385585 commit 2aa4a48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,13 @@ extension Date: XMLElementDeserializable, XMLAttributeDeserializable {
return validDate
}

public func validate() throws {
// empty validate... only necessary for custom validatio logic after parsing
}

private static func stringToDate(_ dateAsString: String) -> Date? {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss zzz"
dateFormatter.dateFormat = "EEEE, dd MMMM yyyy HH:mm:ss SSS"
return dateFormatter.date(from: dateAsString)
}
}
Expand Down

0 comments on commit 2aa4a48

Please sign in to comment.