Skip to content

Commit

Permalink
Use iso8601 date encoding & decoding to match Vapor’s default (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
hallee authored Feb 17, 2024
1 parent a78d20e commit 26a053b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Sources/EndpointBuilderURLSession/EndpointBuilderURLSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,19 @@ extension EndpointBuilderURLSession {
}

public var encoder: @Sendable () -> JSONEncoder {
{ JSONEncoder() }
{
let encoder = JSONEncoder()
encoder.dateEncodingStrategy = .iso8601
return encoder
}
}

public var decoder: @Sendable () -> JSONDecoder {
{ JSONDecoder() }
{
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .iso8601
return decoder
}
}

}
Expand Down

0 comments on commit 26a053b

Please sign in to comment.