Skip to content

Commit

Permalink
dateDecodingStrategy added as described in Issue #184 (#185)
Browse files Browse the repository at this point in the history
* dateDecodingStrategy added as described in #184 (comment)

* dateDecodingStrategy added as described in Issue #184.
  • Loading branch information
gregorFeigel authored Feb 25, 2024
1 parent 9d238d3 commit 4d9d0a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions OctoKit/Issue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ public extension Octokit {
state: Openness? = nil,
completion: @escaping (_ response: Result<Issue, Error>) -> Void) -> URLSessionDataTaskProtocol? {
let router = IssueRouter.patchIssue(configuration, owner, repository, number, title, body, assignee, state)
return router.post(session, expectedResultType: Issue.self) { issue, error in
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .formatted(Time.rfc3339DateFormatter)
return router.post(session, decoder: decoder, expectedResultType: Issue.self) { issue, error in
if let error = error {
completion(.failure(error))
} else {
Expand Down Expand Up @@ -362,7 +364,9 @@ public extension Octokit {
assignee: String? = nil,
state: Openness? = nil) async throws -> Issue {
let router = IssueRouter.patchIssue(configuration, owner, repository, number, title, body, assignee, state)
return try await router.post(session, expectedResultType: Issue.self)
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .formatted(Time.rfc3339DateFormatter)
return try await router.post(session, decoder: decoder, expectedResultType: Issue.self)
}
#endif

Expand Down

0 comments on commit 4d9d0a7

Please sign in to comment.