[ADD] Error log view

This commit is contained in:
Fabian Thies
2023-02-04 13:07:04 +01:00
parent 767d878051
commit fbc754d8b7
6 changed files with 289 additions and 1 deletions

View File

@@ -27,6 +27,14 @@ struct DateFormatterHelper {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.timeStyle = .none
dateFormatter.doesRelativeDateFormatting = true
return dateFormatter
}()
private static let timeFormatter: DateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .none
dateFormatter.timeStyle = .short
return dateFormatter
}()
@@ -53,4 +61,12 @@ struct DateFormatterHelper {
static func string(forRelativeDate date: Date, to referenceDate: Date = Date()) -> String {
self.relativeDateFormatter.localizedString(for: date, relativeTo: referenceDate)
}
static func string(for date: Date) -> String {
self.mediumDateFormatter.string(from: date)
}
static func timeString(for date: Date) -> String {
self.timeFormatter.string(from: date)
}
}