Skip to content

Commit 8fd7e19

Browse files
committed
Use iso8601 date encoding & decoding to match Vapor’s default
1 parent a78d20e commit 8fd7e19

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Sources/EndpointBuilderURLSession/EndpointBuilderURLSession.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,19 @@ extension EndpointBuilderURLSession {
3030
}
3131

3232
public var encoder: @Sendable () -> JSONEncoder {
33-
{ JSONEncoder() }
33+
{
34+
let encoder = JSONEncoder()
35+
encoder.dateEncodingStrategy = .iso8601
36+
return encoder
37+
}
3438
}
3539

3640
public var decoder: @Sendable () -> JSONDecoder {
37-
{ JSONDecoder() }
41+
{
42+
let decoder = JSONDecoder()
43+
decoder.dateDecodingStrategy = .iso8601
44+
return decoder
45+
}
3846
}
3947

4048
}

0 commit comments

Comments
 (0)