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
committed by Joseph Mattello
parent 14bd58e741
commit ae6ed99dc4

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
}
}
}