Displays “TODAY” as section header for logged errors that occured that day

This commit is contained in:
Riley Testut
2022-09-27 15:41:41 -05:00
parent 6cfbe1e0e4
commit 61086e8b1d

View File

@@ -287,8 +287,15 @@ extension ErrorLogViewController
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String?
{
let indexPath = IndexPath(row: 0, section: section)
let loggedError = self.dataSource.item(at: indexPath)
return loggedError.localizedDateString
if Calendar.current.isDateInToday(loggedError.date)
{
return NSLocalizedString("Today", comment: "")
}
else
{
return loggedError.localizedDateString
}
}
}