Andrew Wallo пре 2 месеци
родитељ
комит
a8e0046728
1 измењених фајлова са 9 додато и 1 уклоњено
  1. 9
    1
      app/Providers/MacroServiceProvider.php

+ 9
- 1
app/Providers/MacroServiceProvider.php Прегледај датотеку

@@ -488,12 +488,20 @@ class MacroServiceProvider extends ServiceProvider
488 488
             return $this->format($dateFormat);
489 489
         });
490 490
 
491
-        Carbon::macro('inCompanyTimezone', function () {
491
+        Carbon::macro('toCompanyTimezone', function () {
492 492
             $timezone = CompanySettingsService::getDefaultTimezone();
493 493
 
494
+            // This will convert the date to the company's timezone, possibly changing the date and time
494 495
             return $this->setTimezone($timezone);
495 496
         });
496 497
 
498
+        Carbon::macro('asCompanyTimezone', function () {
499
+            $timezone = CompanySettingsService::getDefaultTimezone();
500
+
501
+            // This will only change the timezone without converting the date and time
502
+            return $this->shiftTimezone($timezone);
503
+        });
504
+
497 505
         ExportColumn::macro('money', function () {
498 506
             $this->formatStateUsing(static function ($state) {
499 507
                 if (blank($state) || ! is_int($state)) {

Loading…
Откажи
Сачувај