Improved the overall documentation for the public and internal types in the package.

This commit is contained in:
2026-03-23 00:25:38 +01:00
parent 69d7681139
commit cd01c27544
15 changed files with 62 additions and 56 deletions
@@ -31,10 +31,16 @@ extension ISOTimestampTranscoder: DateTranscoder {
// MARK: Functions
/// Encodes a date into an ISO timestamp string.
/// - Parameter date: A date to encode.
/// - Returns: A string representation of the date in `yyyy-MM-dd'T'HH:mm:ss.SSSSSS` format.
func encode(_ date: Date) throws -> String {
dateFormatter.string(from: date)
}
/// Decodes an ISO timestamp string into a date.
/// - Parameter string: A string to decode.
/// - Returns: A date parsed from the string, or the Unix epoch if the string cannot be parsed.
func decode(_ string: String) throws -> Date {
dateFormatter.date(from: string) ?? .init()
}