Skip to content

Commit 57766ae

Browse files
committed
Update documentation for Today and to date ranges
1 parent 2db4f01 commit 57766ae

File tree

5 files changed

+64
-9
lines changed

5 files changed

+64
-9
lines changed

WooCommerce/Classes/ViewRelated/Dashboard/Analytics Hub/Time Range/Range Data Generation/AnalyticsHubMonthToDateRangeData.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@ import Foundation
44
/// until the current date and the previous one, starting from the first day of the previous month
55
/// until the same day of the previous month. E. g.
66
///
7-
/// Today: 31 Jul 2022
7+
/// Today: 20 Jul 2022
8+
///
89
/// Current range: Jul 1 until Jul 31, 2022
9-
/// Previous range: Jun 1 until Jun 30, 2022
10+
/// Formatted current range for UI: Jul 1 until Jul 20, 2022
11+
///
12+
/// Previous range: Jun 1 until Jun 20, 2022
13+
/// Formatted previous range for UI: Jun 1 until Jun 20, 2022
14+
///
15+
/// The reason why there's a difference between the current range and the formatted current range
16+
/// is due to the My Store rule that creates the end date far in the future for each tab instead of using today's date.
17+
/// This behavior covers any time zone gap between the app and the store, always fetching as much data in “the future” as possible.
18+
///
19+
/// For data consistency, the Analytics Hub should follow the same for this range,
20+
/// but only for the current one, the previous should remain using the today's date as the reference for the end date.
1021
///
1122
struct AnalyticsHubMonthToDateRangeData: AnalyticsHubTimeRangeData {
1223
let currentDateStart: Date?

WooCommerce/Classes/ViewRelated/Dashboard/Analytics Hub/Time Range/Range Data Generation/AnalyticsHubQuarterToDateRangeData.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@ import Foundation
55
/// until the same relative day of the previous quarter. E. g.
66
///
77
/// Today: 15 Feb 2022
8-
/// Current range: Jan 1 until Feb 15, 2022
8+
///
9+
/// Current range: Jan 1 until Mar 31, 2022
10+
/// Formatted current range for UI: Jan 1 until Feb 15, 2022
11+
///
912
/// Previous range: Oct 1 until Nov 15, 2021
13+
/// Formatted previous range for UI: Jan 1 until Nov 15, 2021
14+
///
15+
/// The reason why there's a difference between the current range and the formatted current range
16+
/// is due to the My Store rule that creates the end date far in the future for each tab instead of using today's date.
17+
/// This behavior covers any time zone gap between the app and the store, always fetching as much data in “the future” as possible.
18+
///
19+
/// For data consistency, the Analytics Hub should follow the same for this range,
20+
/// but only for the current one, the previous should remain using the today's date as the reference for the end date.
1021
///
1122
struct AnalyticsHubQuarterToDateRangeData: AnalyticsHubTimeRangeData {
1223
let currentDateStart: Date?

WooCommerce/Classes/ViewRelated/Dashboard/Analytics Hub/Time Range/Range Data Generation/AnalyticsHubTodayRangeData.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@ import Foundation
44
/// until the same day in the current time and the previous one, starting from the first second of
55
/// yesterday until the same time of that day. E. g.
66
///
7-
/// Today: 29 Jul 2022
8-
/// Current range: Jul 29 until Jul 29, 2022
9-
/// Previous range: Jul 28 until Jul 28, 2022
7+
/// Today: 29 Jul 11:30 AM 2022
8+
///
9+
/// Current range: Jul 29 00:00 until Jul 29 23:59, 2022
10+
/// Formatted current range for UI: Jul 29, 2022
11+
///
12+
/// Previous range: Jul 28 00:00 until Jul 28 11:30 AM, 2022
13+
/// Formatted previous range for UI: Jul 28, 2022
14+
///
15+
/// The reason why there's a difference between the current range and the formatted current range
16+
/// is due to the My Store rule that creates the end date far in the future for each tab instead of using today's date.
17+
/// This behavior covers any time zone gap between the app and the store, always fetching as much data in “the future” as possible.
18+
///
19+
/// For data consistency, the Analytics Hub should follow the same for this range,
20+
/// but only for the current one, the previous should remain using the today's date as the reference for the end date.
1021
///
1122
struct AnalyticsHubTodayRangeData: AnalyticsHubTimeRangeData {
1223
let currentDateStart: Date?

WooCommerce/Classes/ViewRelated/Dashboard/Analytics Hub/Time Range/Range Data Generation/AnalyticsHubWeekToDateRangeData.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@ import Foundation
55
/// until the same day of that week. E. g.
66
///
77
/// Today: 29 Jul 2022
8-
/// Current range: Jul 25 until Jul 29, 2022
8+
///
9+
/// Current range: Jul 25 until Jul 31, 2022
10+
/// Formatted current range for UI: Jul 25 until Jul 29, 2022
11+
///
912
/// Previous range: Jul 18 until Jul 22, 2022
13+
/// Formatted previous range for UI: Jul 18 until Jul 22, 2022
14+
///
15+
/// The reason why there's a difference between the current range and the formatted current range
16+
/// is due to the My Store rule that creates the end date far in the future for each tab instead of using today's date.
17+
/// This behavior covers any time zone gap between the app and the store, always fetching as much data in “the future” as possible.
18+
///
19+
/// For data consistency, the Analytics Hub should follow the same for this range,
20+
/// but only for the current one, the previous should remain using the today's date as the reference for the end date.
1021
///
1122
struct AnalyticsHubWeekToDateRangeData: AnalyticsHubTimeRangeData {
1223
let currentDateStart: Date?

WooCommerce/Classes/ViewRelated/Dashboard/Analytics Hub/Time Range/Range Data Generation/AnalyticsHubYearToDateRangeData.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@ import Foundation
55
/// until the same day on the in that year. E. g.
66
///
77
/// Today: 1 Jul 2022
8-
/// Current range: Jan 1 until Jul 1, 2022
9-
/// Previous range: Jan 1 until Jul 1, 2022
8+
///
9+
/// Current range: Jan 1 until Dec 31, 2022
10+
/// Formatted current range for UI: Jan 1 until Jul 1, 2022
11+
///
12+
/// Previous range: Jan 1 until Jul 1, 2021
13+
/// Formatted previous range for UI: Jan 1 until Jul 1, 2021
14+
///
15+
/// The reason why there's a difference between the current range and the formatted current range
16+
/// is due to the My Store rule that creates the end date far in the future for each tab instead of using today's date.
17+
/// This behavior covers any time zone gap between the app and the store, always fetching as much data in “the future” as possible.
18+
///
19+
/// For data consistency, the Analytics Hub should follow the same for this range,
20+
/// but only for the current one, the previous should remain using the today's date as the reference for the end date.
1021
///
1122
struct AnalyticsHubYearToDateRangeData: AnalyticsHubTimeRangeData {
1223
let currentDateStart: Date?

0 commit comments

Comments
 (0)