Skip to content

Commit

Permalink
Handle timestamp in microseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
j-gao authored Mar 23, 2020
1 parent 18c74a4 commit 069b69a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SwiftyInsta/Local/Responses/ThreadResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public struct Message: ItemIdentifiableParsedResponse, UserIdentifiableParsedRes
public var sentAt: Date {
return rawResponse.timestamp
.double
.flatMap { $0 > 9_999_999_999_999 ? $0/1_000_000 : ($0 > 9_999_999_999 ? $0/1_000 : $0) }
.flatMap { $0 / pow(10.0, max(floor(log10($0)) - 9, 0)) }
.flatMap { Date(timeIntervalSince1970: $0) } ?? .distantPast
}
/// The `text` value.
Expand Down

0 comments on commit 069b69a

Please sign in to comment.