Skip to content

Commit 1adaee7

Browse files
authored
Emit createdDate and lastModifiedDate in JSON-format output. (#86)
1 parent 7bd8624 commit 1adaee7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Sources/RemindersLibrary/EKReminder+Encodable.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import EventKit
33
extension EKReminder: Encodable {
44
private enum EncodingKeys: String, CodingKey {
55
case externalId
6+
case lastModified
7+
case creationDate
68
case title
79
case notes
810
case url
@@ -48,6 +50,14 @@ extension EKReminder: Encodable {
4850
if let dueDateComponents = self.dueDateComponents {
4951
try container.encodeIfPresent(format(dueDateComponents.date), forKey: .dueDate)
5052
}
53+
54+
if let lastModifiedDate = self.lastModifiedDate {
55+
try container.encode(format(lastModifiedDate), forKey: .lastModified)
56+
}
57+
58+
if let creationDate = self.creationDate {
59+
try container.encode(format(creationDate), forKey: .creationDate)
60+
}
5161
}
5262

5363
private func format(_ date: Date?) -> String? {

0 commit comments

Comments
 (0)