Add support for Date type to StructuredFieldValues (#49)

Motivation:

The parser and serializer for the Date type has been implemented. The high-level encoder and decoder should follow.

Modifications:

- Implement the encoder and decoder for Date.

Result:

The StructuredFieldValues module will support the Date type.
This commit is contained in:
Clinton Nkwocha authored and GitHub committed 2024-11-26 16:04:41 +00:00
1 parent c2e79ce44c
commit 6e527aa16a
12 files changed
+222

No files matched your search

@@ -60,6 +60,9 @@ extension KeyedTopLevelListDecoder: KeyedDecodingContainerProtocol {
} else if type is Decimal.Type {
let container = try self.decoder.singleValueContainer()
return try container.decode(Decimal.self) as! T
} else if type is Date.Type {
let container = try self.decoder.singleValueContainer()
return try container.decode(Date.self) as! T
} else {
return try type.init(from: self.decoder)
}