mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
Use ISO8601DateFormatter
.
Resolve #613 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
705563ced9
commit
e79e6283ac
1 changed files with 3 additions and 7 deletions
|
@ -47,12 +47,8 @@ enum AppInfoFormatter {
|
||||||
/// - Parameter serverDate: String containing a date in ISO-8601 format.
|
/// - Parameter serverDate: String containing a date in ISO-8601 format.
|
||||||
/// - Returns: Simple date format.
|
/// - Returns: Simple date format.
|
||||||
private static func humanReadableDate(_ serverDate: String) -> String {
|
private static func humanReadableDate(_ serverDate: String) -> String {
|
||||||
let serverDateFormatter = DateFormatter()
|
let humanDateFormatter = ISO8601DateFormatter()
|
||||||
serverDateFormatter.locale = Locale(identifier: "en_US_POSIX")
|
humanDateFormatter.formatOptions = [.withFullDate]
|
||||||
serverDateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
|
return ISO8601DateFormatter().date(from: serverDate).map(humanDateFormatter.string(from:)) ?? ""
|
||||||
|
|
||||||
let humanDateFormatter = DateFormatter()
|
|
||||||
humanDateFormatter.dateFormat = "yyyy-MM-dd"
|
|
||||||
return serverDateFormatter.date(from: serverDate).flatMap(humanDateFormatter.string(from:)) ?? ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue