@@ -25,15 +25,10 @@ final class StoreInfoDataService {
2525 ///
2626 private var network : AlamofireNetwork
2727
28- /// Timezone of the website
29- ///
30- private let siteTimeZone : TimeZone
31-
32- init ( authToken: String , siteTimeZone: TimeZone ) {
28+ init ( authToken: String ) {
3329 network = AlamofireNetwork ( credentials: Credentials ( authToken: authToken) )
3430 orderStatsRemoteV4 = OrderStatsRemoteV4 ( network: network)
3531 siteVisitStatsRemote = SiteVisitStatsRemote ( network: network)
36- self . siteTimeZone = siteTimeZone
3732 }
3833
3934 /// Async function that fetches todays stats data.
@@ -63,12 +58,12 @@ private extension StoreInfoDataService {
6358 ///
6459 func fetchTodaysRevenueAndOrders( for storeID: Int64 ) async throws -> OrderStatsV4 {
6560 try await withCheckedThrowingContinuation { continuation in
66- // `WKWebView` is accessed internally, we are foreced to dispatch the call in the main thread.
61+ // `WKWebView` is accessed internally, we are forced to dispatch the call in the main thread.
6762 Task { @MainActor in
6863 orderStatsRemoteV4. loadOrderStats ( for: storeID,
6964 unit: . hourly,
70- earliestDateToInclude: Date ( ) . startOfDay ( timezone: siteTimeZone ) ,
71- latestDateToInclude: Date ( ) . endOfDay ( timezone: siteTimeZone ) ,
65+ earliestDateToInclude: Date ( ) . startOfDay ( timezone: . current ) ,
66+ latestDateToInclude: Date ( ) . endOfDay ( timezone: . current ) ,
7267 quantity: 24 ,
7368 forceRefresh: true ) { result in
7469 continuation. resume ( with: result)
@@ -85,7 +80,7 @@ private extension StoreInfoDataService {
8580 Task { @MainActor in
8681 siteVisitStatsRemote. loadSiteVisitorStats ( for: storeID,
8782 unit: . day,
88- latestDateToInclude: Date ( ) . endOfDay ( timezone: siteTimeZone ) ,
83+ latestDateToInclude: Date ( ) . endOfDay ( timezone: . current ) ,
8984 quantity: 1 ) { result in
9085 continuation. resume ( with: result)
9186 }
0 commit comments