Merge pull request #2996 from stuartbreckenridge/fix/2994

Fixes #2994
This commit is contained in:
Brent Simmons 2021-04-12 21:18:49 -07:00 committed by GitHub
commit 4355d7617a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -59,12 +59,14 @@ struct ArticleItemView: View {
func pubDate(_ dateString: String) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss Z"
let date = dateFormatter.date(from: dateString)
guard let date = dateFormatter.date(from: dateString) else {
return ""
}
let displayFormatter = DateFormatter()
displayFormatter.dateStyle = .medium
displayFormatter.timeStyle = .none
return displayFormatter.string(from: date!)
return displayFormatter.string(from: date)
}
}