Skip to content

Commit

Permalink
Pass empty date to reset date using XMLRPC
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Apr 11, 2024
1 parent 9ff448f commit a92a99b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/WordPressKit/Models/RemotePostParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public struct RemotePostUpdateParameters: Equatable {
public var ifNotModifiedSince: Date?

public var status: String?
public var date: Date?
public var date: Date??
public var authorID: Int?
public var title: String??
public var content: String??
Expand Down Expand Up @@ -394,7 +394,13 @@ struct RemotePostUpdateParametersXMLRPCEncoder: Encodable {
var container = encoder.container(keyedBy: RemotePostXMLRPCCodingKeys.self)
try container.encodeIfPresent(parameters.ifNotModifiedSince, forKey: .ifNotModifiedSince)
try container.encodeStringIfPresent(parameters.status, forKey: .postStatus)
try container.encodeIfPresent(parameters.date, forKey: .date)
if let change = parameters.date {
if let date = change {
try container.encode(date, forKey: .date)
} else {
try container.encode("", forKey: .date)
}
}
try container.encodeIfPresent(parameters.authorID, forKey: .authorID)
try container.encodeStringIfPresent(parameters.title, forKey: .title)
try container.encodeStringIfPresent(parameters.content, forKey: .content)
Expand Down

0 comments on commit a92a99b

Please sign in to comment.