Andrew Wallo 2 months ago
parent
commit
fb209e5d7b
2 changed files with 7 additions and 3 deletions
  1. 6
    2
      app/Providers/MacroServiceProvider.php
  2. 1
    1
      app/Services/DateRangeService.php

+ 6
- 2
app/Providers/MacroServiceProvider.php View File

485
         Carbon::macro('toDefaultDateFormat', function () {
485
         Carbon::macro('toDefaultDateFormat', function () {
486
             $dateFormat = CompanySettingsService::getDefaultDateFormat();
486
             $dateFormat = CompanySettingsService::getDefaultDateFormat();
487
 
487
 
488
-            $this->format($dateFormat);
488
+            return $this->format($dateFormat);
489
+        });
489
 
490
 
490
-            return $this;
491
+        Carbon::macro('inCompanyTimezone', function () {
492
+            $timezone = CompanySettingsService::getDefaultTimezone();
493
+
494
+            return $this->setTimezone($timezone);
491
         });
495
         });
492
 
496
 
493
         ExportColumn::macro('money', function () {
497
         ExportColumn::macro('money', function () {

+ 1
- 1
app/Services/DateRangeService.php View File

89
 
89
 
90
                 $expectedEnd = $expectedEnd->isFuture() ? company_today() : $expectedEnd;
90
                 $expectedEnd = $expectedEnd->isFuture() ? company_today() : $expectedEnd;
91
 
91
 
92
-                if ($startDate->eq($expectedStart) && $endDate->eq($expectedEnd)) {
92
+                if ($startDate->isSameDay($expectedStart) && $endDate->isSameDay($expectedEnd)) {
93
                     return $key; // Return the matching range key (e.g., "FY-2024")
93
                     return $key; // Return the matching range key (e.g., "FY-2024")
94
                 }
94
                 }
95
             }
95
             }

Loading…
Cancel
Save