Skip to content

Commit 35bd252

Browse files
committed
Fix today's date formatter for selected date and x-axis.
1 parent 3de9e38 commit 35bd252

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

WooCommerce/Classes/Extensions/DateFormatter+Helpers.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,25 @@ extension DateFormatter {
1010

1111
// MARK: - Chark axis formatters
1212

13-
/// Date formatter used for creating the date displayed on a chart axis for **hour** granularity.
13+
/// Date formatter used for creating the date for a selected date displayed on the time range bar for **hour** granularity.
1414
///
15-
public static let chartAxisHourFormatter: DateFormatter = {
15+
public static let chartSelectedDateHourFormatter: DateFormatter = {
1616
let formatter = DateFormatter()
1717
formatter.setLocalizedDateFormatFromTemplate("EEEE, MMM d, h:mm a")
1818
return formatter
1919
}()
2020

21+
/// Date formatter used for creating the date for a selected date displayed on the time range bar for **hour** granularity.
22+
///
23+
public static let legacyChartSelectedDateHourFormatter: DateFormatter = {
24+
let formatter = DateFormatter()
25+
formatter.setLocalizedDateFormatFromTemplate("ha")
26+
return formatter
27+
}()
28+
2129
/// Date formatter used for creating the date displayed on a chart axis for **hour** granularity.
2230
///
23-
public static let legacyChartAxisHourFormatter: DateFormatter = {
31+
public static let chartAxisHourFormatter: DateFormatter = {
2432
let formatter = DateFormatter()
2533
formatter.setLocalizedDateFormatFromTemplate("ha")
2634
return formatter

WooCommerce/Classes/ViewRelated/Dashboard/Stats v4/StatsTimeRangeBarViewModel.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ private extension StatsTimeRangeV4 {
6464
let dateFormatter: DateFormatter
6565
switch self {
6666
case .today:
67-
dateFormatter = isMyStoreTabUpdatesEnabled ? DateFormatter.Charts.chartAxisHourFormatter: DateFormatter.Charts.legacyChartAxisHourFormatter
67+
dateFormatter = isMyStoreTabUpdatesEnabled ?
68+
DateFormatter.Charts.chartSelectedDateHourFormatter:
69+
DateFormatter.Charts.legacyChartSelectedDateHourFormatter
6870
case .thisWeek, .thisMonth:
6971
dateFormatter = DateFormatter.Charts.chartAxisDayFormatter
7072
case .thisYear:

0 commit comments

Comments
 (0)