mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-03 05:21:55 +01:00
reworked gaurd statement
This commit is contained in:
parent
307b24af1b
commit
7df2fa5b1e
@ -59,16 +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
|
||||
|
||||
guard let dateFromDateFormatter = date else {
|
||||
return ""
|
||||
}
|
||||
|
||||
return displayFormatter.string(from: dateFromDateFormatter)
|
||||
return displayFormatter.string(from: date)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user