浏览代码

wip timezone handling

3.x
Andrew Wallo 2 个月前
父节点
当前提交
9f8e4c891c

+ 1
- 1
app/Enums/Setting/WeekStart.php 查看文件

@@ -18,6 +18,6 @@ enum WeekStart: int implements HasLabel
18 18
 
19 19
     public function getLabel(): ?string
20 20
     {
21
-        return today()->isoWeekday($this->value)->dayName;
21
+        return company_today()->isoWeekday($this->value)->dayName;
22 22
     }
23 23
 }

+ 2
- 2
app/Jobs/ProcessTransactionImport.php 查看文件

@@ -30,7 +30,7 @@ class ProcessTransactionImport implements ShouldQueue
30 30
     public function handle(PlaidService $plaid, TransactionService $transactionService): void
31 31
     {
32 32
         $accessToken = $this->connectedBankAccount->access_token;
33
-        $endDate = Carbon::now()->toDateString();
33
+        $endDate = company_now()->toDateString();
34 34
         $startDate = Carbon::parse($this->startDate)->toDateString();
35 35
         $allTransactions = [];
36 36
         $offset = 0;
@@ -64,7 +64,7 @@ class ProcessTransactionImport implements ShouldQueue
64 64
             $transactionService->storeTransactions($this->company, $this->bankAccount, $newTransactions);
65 65
 
66 66
             $this->connectedBankAccount->update([
67
-                'last_imported_at' => Carbon::now(),
67
+                'last_imported_at' => company_now(),
68 68
             ]);
69 69
         }
70 70
     }

+ 2
- 2
app/Jobs/ProcessTransactionUpdate.php 查看文件

@@ -39,7 +39,7 @@ class ProcessTransactionUpdate implements ShouldQueue
39 39
             $bufferDays = 15;
40 40
             $lastImportedAtDate = Carbon::parse($connectedBankAccount->last_imported_at);
41 41
             $startDate = $lastImportedAtDate->subDays($bufferDays)->toDateString();
42
-            $endDate = Carbon::now()->toDateString();
42
+            $endDate = company_today()->toDateString();
43 43
 
44 44
             $transactionsResponse = $plaidService->getTransactions($accessToken, $startDate, $endDate, [
45 45
                 'account_ids' => [$connectedBankAccount->external_account_id],
@@ -67,7 +67,7 @@ class ProcessTransactionUpdate implements ShouldQueue
67 67
                 $transactionService->storeTransactions($this->company, $bankAccount, $newTransactions);
68 68
 
69 69
                 $connectedBankAccount->update([
70
-                    'last_imported_at' => Carbon::now(),
70
+                    'last_imported_at' => company_now(),
71 71
                 ]);
72 72
             }
73 73
         }

+ 1
- 1
app/Listeners/UpdateAccountBalances.php 查看文件

@@ -58,7 +58,7 @@ class UpdateAccountBalances
58 58
                         'type' => $transactionType,
59 59
                         'amount' => $formattedSimpleDifference,
60 60
                         'payment_channel' => 'other',
61
-                        'posted_at' => today(),
61
+                        'posted_at' => company_today(),
62 62
                         'description' => $description,
63 63
                         'pending' => false,
64 64
                         'reviewed' => false,

+ 2
- 2
app/Providers/MacroServiceProvider.php 查看文件

@@ -176,7 +176,7 @@ class MacroServiceProvider extends ServiceProvider
176 176
             $localization = Localization::firstOrFail();
177 177
 
178 178
             $dateFormat = $localization->date_format->value ?? DateFormat::DEFAULT;
179
-            $timezone = $localization->timezone ?? Carbon::now()->timezoneName;
179
+            $timezone = $localization->timezone ?? company_now()->timezoneName;
180 180
 
181 181
             $this->date($dateFormat, $timezone);
182 182
 
@@ -187,7 +187,7 @@ class MacroServiceProvider extends ServiceProvider
187 187
             $localization = Localization::firstOrFail();
188 188
 
189 189
             $dateFormat = $localization->date_format->value ?? DateFormat::DEFAULT;
190
-            $timezone = $localization->timezone ?? Carbon::now()->timezoneName;
190
+            $timezone = $localization->timezone ?? company_now()->timezoneName;
191 191
 
192 192
             $this->displayFormat($dateFormat)
193 193
                 ->timezone($timezone);

+ 1
- 1
app/Services/AccountService.php 查看文件

@@ -372,7 +372,7 @@ class AccountService
372 372
     {
373 373
         $earliestDate = Transaction::min('posted_at');
374 374
 
375
-        return $earliestDate ?? today()->toDateTimeString();
375
+        return $earliestDate ?? company_today()->toDateTimeString();
376 376
     }
377 377
 
378 378
     public function getUnpaidClientInvoices(?string $asOfDate = null): Builder

+ 2
- 2
app/Services/ExportService.php 查看文件

@@ -28,7 +28,7 @@ class ExportService
28 28
             $dateLabel = $formattedAsOfDate;
29 29
         }
30 30
 
31
-        $timestamp = Carbon::now()->format('Y-m-d_H-i-s');
31
+        $timestamp = company_now()->format('Y-m-d_H-i-s');
32 32
 
33 33
         $filename = $company->name . ' ' . $report->getTitle() . ' ' . $dateLabel . ' ' . $timestamp . '.csv';
34 34
 
@@ -269,7 +269,7 @@ class ExportService
269 269
             $dateLabel = $formattedAsOfDate;
270 270
         }
271 271
 
272
-        $timestamp = Carbon::now()->format('Y-m-d_H-i-s');
272
+        $timestamp = company_now()->format('Y-m-d_H-i-s');
273 273
 
274 274
         $filename = $company->name . ' ' . $report->getTitle() . ' ' . $dateLabel . ' ' . $timestamp . '.pdf';
275 275
 

+ 1
- 1
app/Support/ScheduleHandler.php 查看文件

@@ -22,7 +22,7 @@ class ScheduleHandler
22 22
 
23 23
     public function __construct(Set $set, ?Get $get = null)
24 24
     {
25
-        $this->today = today()->toImmutable();
25
+        $this->today = company_today()->toImmutable();
26 26
         $this->set = $set;
27 27
         $this->get = $get;
28 28
     }

正在加载...
取消
保存