Use relative time format for Last Updated
This commit is contained in:
@@ -348,7 +348,7 @@ public struct ProfileCard: View {
|
||||
Image(systemName: "clock.fill")
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(.secondary)
|
||||
Text(lastUpdated.myFormat)
|
||||
Text(lastUpdated.relativeFormat)
|
||||
.font(.caption)
|
||||
.foregroundColor(.primary)
|
||||
}
|
||||
|
||||
@@ -892,7 +892,7 @@ private struct ProfilePickerRow: View {
|
||||
Image(systemName: "clock.fill")
|
||||
.font(.system(size: 12))
|
||||
.foregroundStyle(.secondary)
|
||||
Text(lastUpdated.myFormat)
|
||||
Text(lastUpdated.relativeFormat)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
@@ -947,7 +947,7 @@ private struct ProfilePickerRow: View {
|
||||
Image(systemName: "clock.fill")
|
||||
.font(.system(size: 12))
|
||||
.foregroundStyle(.secondary)
|
||||
Text(lastUpdated.myFormat)
|
||||
Text(lastUpdated.relativeFormat)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
@@ -1155,7 +1155,7 @@ private struct ProfilePickerRow: View {
|
||||
Image(systemName: "clock.fill")
|
||||
.font(.system(size: 12))
|
||||
.foregroundStyle(.secondary)
|
||||
Text(lastUpdated.myFormat)
|
||||
Text(lastUpdated.relativeFormat)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public struct EditProfileView: View {
|
||||
}
|
||||
if profile.type == .remote {
|
||||
Section("Status") {
|
||||
FormTextItem("Last Updated", profile.lastUpdated!.myFormat)
|
||||
FormTextItem("Last Updated", profile.lastUpdated!.relativeFormat)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ public struct ProfileView: View {
|
||||
Text(profile.name)
|
||||
if profile.type == .remote {
|
||||
Spacer(minLength: 4)
|
||||
Text("Last Updated: \(profile.origin.lastUpdated!.myFormat)").font(.caption)
|
||||
Text("Last Updated: \(profile.origin.lastUpdated!.relativeFormat)").font(.caption)
|
||||
}
|
||||
}
|
||||
HStack {
|
||||
|
||||
@@ -6,4 +6,10 @@ public extension Date {
|
||||
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
||||
return dateFormatter.string(from: self)
|
||||
}
|
||||
|
||||
var relativeFormat: String {
|
||||
let formatter = RelativeDateTimeFormatter()
|
||||
formatter.unitsStyle = .full
|
||||
return formatter.localizedString(for: self, relativeTo: Date())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user