Skip to content

Commit

Permalink
Dateformatter를 iso8601 로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
87kangsw committed Jul 18, 2023
1 parent a6e52f7 commit 3dd73b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions GitTime/Sources/Models/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ struct Event: ModelType {
repo = try container.decode(RepositoryInfo.self, forKey: .repo)
isPublic = try container.decode(Bool.self, forKey: .isPublic)
let dateString = try container.decode(String.self, forKey: .createdAt)
let df = DateFormatter()
df.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
let df = ISO8601DateFormatter()
createdAt = df.date(from: dateString) ?? Date()

switch type {
Expand Down
3 changes: 1 addition & 2 deletions GitTime/Sources/Models/Payload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,7 @@ struct Comment: ModelType {
body = try container.decode(String.self, forKey: .body)

let dateString = try container.decode(String.self, forKey: .createdAt)
let df = DateFormatter()
df.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
let df = ISO8601DateFormatter()
createdAt = df.date(from: dateString) ?? Date()
}

Expand Down

0 comments on commit 3dd73b4

Please sign in to comment.