Skip to content

Commit 1a8a909

Browse files
committed
Cleaned up dates
1 parent eb77873 commit 1a8a909

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

WooCommerce/Classes/ViewRelated/Dashboard/MyStore/PeriodDataViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ extension PeriodDataViewController: IAxisValueFormatter {
179179

180180
if axis is XAxis {
181181
if let item = orderStats.items?[Int(value)] {
182-
// FIXME: This logic could prolly be pushed into a model extension
183182
var dateString = ""
184183
switch orderStats.granularity {
185184
case .day:
@@ -188,7 +187,8 @@ extension PeriodDataViewController: IAxisValueFormatter {
188187
}
189188
case .week:
190189
if let periodDate = DateFormatter.Stats.statsWeekFormatter.date(from: item.period) {
191-
dateString = DateFormatter.Charts.chartsWeekFormatter.string(from: periodDate)
190+
let firstMonday = Calendar.current.date(byAdding: .day, value: 1, to: periodDate) ?? periodDate
191+
dateString = DateFormatter.Charts.chartsWeekFormatter.string(from: firstMonday)
192192
}
193193
case .month:
194194
if let periodDate = DateFormatter.Stats.statsMonthFormatter.date(from: item.period) {

0 commit comments

Comments
 (0)