mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-05 16:59:30 +00:00
Always display relative date in the timeline
This commit is contained in:
parent
88ac6e1de5
commit
ce41e6b000
5 changed files with 7 additions and 11 deletions
|
@ -31,7 +31,7 @@ struct ConversationsListRow: View {
|
|||
.foregroundColor(theme.tintColor)
|
||||
.frame(width: 10, height: 10)
|
||||
}
|
||||
Text(conversation.lastStatus.createdAt.formatted)
|
||||
Text(conversation.lastStatus.createdAt.relativeFormatted)
|
||||
.font(.scaledFootnote)
|
||||
}
|
||||
Text(conversation.lastStatus.content.asRawText)
|
||||
|
|
|
@ -29,12 +29,8 @@ extension ServerDate {
|
|||
Self.createdAtDateFormatter.date(from: self)!
|
||||
}
|
||||
|
||||
public var formatted: String {
|
||||
if Self.calendar.numberOfDaysBetween(asDate, and: Date()) > 1 {
|
||||
return Self.createdAtShortDateFormatted.string(from: asDate)
|
||||
} else {
|
||||
return Self.createdAtRelativeFormatter.localizedString(for: asDate, relativeTo: Date())
|
||||
}
|
||||
public var relativeFormatted: String {
|
||||
return Self.createdAtRelativeFormatter.localizedString(for: asDate, relativeTo: Date())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ struct NotificationRowView: View {
|
|||
.font(.scaledFootnote)
|
||||
.fontWeight(.regular)
|
||||
.foregroundColor(.gray) +
|
||||
Text(notification.createdAt.formatted)
|
||||
Text(notification.createdAt.relativeFormatted)
|
||||
.font(.scaledFootnote)
|
||||
.fontWeight(.regular)
|
||||
.foregroundColor(.gray)
|
||||
|
|
|
@ -41,7 +41,7 @@ public struct StatusEmbeddedView: View {
|
|||
Group {
|
||||
Text("@\(account.acct)") +
|
||||
Text(" ⸱ ") +
|
||||
Text(status.reblog?.createdAt.formatted ?? status.createdAt.formatted)
|
||||
Text(status.reblog?.createdAt.relativeFormatted ?? status.createdAt.relativeFormatted)
|
||||
}
|
||||
.font(.scaledCaption)
|
||||
.foregroundColor(.gray)
|
||||
|
|
|
@ -197,7 +197,7 @@ public struct StatusRowView: View {
|
|||
.accessibilityHidden(true)
|
||||
}
|
||||
.accessibilityElement()
|
||||
.accessibilityLabel(Text("\(status.account.displayName), \(status.createdAt.formatted)"))
|
||||
.accessibilityLabel(Text("\(status.account.displayName), \(status.createdAt.relativeFormatted)"))
|
||||
}
|
||||
makeStatusContentView(status: status)
|
||||
.contentShape(Rectangle())
|
||||
|
@ -266,7 +266,7 @@ public struct StatusRowView: View {
|
|||
Group {
|
||||
Text("@\(status.account.acct)") +
|
||||
Text(" ⸱ ") +
|
||||
Text(status.createdAt.formatted) +
|
||||
Text(status.createdAt.relativeFormatted) +
|
||||
Text(" ⸱ ") +
|
||||
Text(Image(systemName: viewModel.status.visibility.iconName))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue