Ver código fonte

wip timezone handling

3.x
Andrew Wallo 2 meses atrás
pai
commit
b31677a91d
1 arquivos alterados com 8 adições e 16 exclusões
  1. 8
    16
      app/Providers/MacroServiceProvider.php

+ 8
- 16
app/Providers/MacroServiceProvider.php Ver arquivo

5
 use Akaunting\Money\Currency;
5
 use Akaunting\Money\Currency;
6
 use Akaunting\Money\Money;
6
 use Akaunting\Money\Money;
7
 use App\Enums\Accounting\AdjustmentComputation;
7
 use App\Enums\Accounting\AdjustmentComputation;
8
-use App\Enums\Setting\DateFormat;
9
 use App\Models\Accounting\AccountSubtype;
8
 use App\Models\Accounting\AccountSubtype;
10
-use App\Models\Setting\Localization;
11
 use App\Services\CompanySettingsService;
9
 use App\Services\CompanySettingsService;
12
 use App\Utilities\Accounting\AccountCode;
10
 use App\Utilities\Accounting\AccountCode;
13
 use App\Utilities\Currency\CurrencyAccessor;
11
 use App\Utilities\Currency\CurrencyAccessor;
173
         });
171
         });
174
 
172
 
175
         TextColumn::macro('defaultDateFormat', function (): static {
173
         TextColumn::macro('defaultDateFormat', function (): static {
176
-            $localization = Localization::firstOrFail();
174
+            $dateFormat = CompanySettingsService::getDefaultDateFormat();
177
 
175
 
178
-            $dateFormat = $localization->date_format->value ?? DateFormat::DEFAULT;
179
-            $timezone = $localization->timezone ?? company_now()->timezoneName;
180
-
181
-            $this->date($dateFormat, $timezone);
176
+            $this->date($dateFormat);
182
 
177
 
183
             return $this;
178
             return $this;
184
         });
179
         });
185
 
180
 
186
         DatePicker::macro('defaultDateFormat', function (): static {
181
         DatePicker::macro('defaultDateFormat', function (): static {
187
-            $localization = Localization::firstOrFail();
188
-
189
-            $dateFormat = $localization->date_format->value ?? DateFormat::DEFAULT;
190
-            $timezone = $localization->timezone ?? company_now()->timezoneName;
182
+            $dateFormat = CompanySettingsService::getDefaultDateFormat();
191
 
183
 
192
-            $this->displayFormat($dateFormat)
193
-                ->timezone($timezone);
184
+            $this->displayFormat($dateFormat);
194
 
185
 
195
             return $this;
186
             return $this;
196
         });
187
         });
492
         });
483
         });
493
 
484
 
494
         Carbon::macro('toDefaultDateFormat', function () {
485
         Carbon::macro('toDefaultDateFormat', function () {
495
-            $companyId = auth()->user()?->current_company_id;
496
-            $dateFormat = CompanySettingsService::getDefaultDateFormat($companyId);
486
+            $dateFormat = CompanySettingsService::getDefaultDateFormat();
497
 
487
 
498
-            return $this->format($dateFormat);
488
+            $this->format($dateFormat);
489
+
490
+            return $this;
499
         });
491
         });
500
 
492
 
501
         ExportColumn::macro('money', function () {
493
         ExportColumn::macro('money', function () {

Carregando…
Cancelar
Salvar