Skip to content

Commit

Permalink
show week subtitle inline
Browse files Browse the repository at this point in the history
  • Loading branch information
wattson12 committed Sep 7, 2024
1 parent 9c54dce commit 4c12af8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Packages/Sources/Features/Goals/GoalHistory/GoalHistoryRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension DateRange {
public extension DateFormatter {
static var weekHistorySubtitle: DateFormatter {
let formatter = DateFormatter()
formatter.dateFormat = "''yy"
formatter.dateFormat = "yyyy"
return formatter
}
}
Expand All @@ -29,13 +29,16 @@ struct GoalHistoryRow: View {
var body: some View {
HStack {
VStack(alignment: .leading) {
Text(history.dateRange.dateForHistory, formatter: DateFormatter.rangeTitle(for: history.dateRange.period))
.font(.title)

if history.dateRange.period == .weekly {
Text(history.dateRange.dateForHistory, formatter: DateFormatter.weekHistorySubtitle)
Text(history.dateRange.dateForHistory, formatter: DateFormatter.rangeTitle(for: history.dateRange.period))
.font(.title)
+ Text(" ") +
Text(history.dateRange.dateForHistory, formatter: DateFormatter.weekHistorySubtitle)
.font(.body)
.foregroundStyle(.secondary)
} else {
Text(history.dateRange.dateForHistory, formatter: DateFormatter.rangeTitle(for: history.dateRange.period))
.font(.title)
}
}

Expand Down

0 comments on commit 4c12af8

Please sign in to comment.