fix: correctly apply due dates for contract and invoice upload reminders
This commit is contained in:
@@ -8,7 +8,7 @@ use App\Entity\Teamer;
|
||||
use App\Entity\Upload;
|
||||
use App\Service\Teamer\PickupResolver;
|
||||
use App\Service\Upload\UploadHandler;
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Twig\Environment;
|
||||
@@ -222,13 +222,13 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
|
||||
public function dateDiffForHumans(\DateTimeInterface $dateTime, ?\DateTimeInterface $other = null): string
|
||||
{
|
||||
$oldLocale = Carbon::getLocale();
|
||||
$oldLocale = CarbonImmutable::getLocale();
|
||||
$locale = $this->requestStack->getMainRequest()->getLocale();
|
||||
Carbon::setLocale($locale);
|
||||
CarbonImmutable::setLocale($locale);
|
||||
|
||||
$result = Carbon::instance($dateTime)->diffForHumans($other);
|
||||
$result = CarbonImmutable::instance($dateTime)->diffForHumans($other);
|
||||
|
||||
Carbon::setLocale($oldLocale);
|
||||
CarbonImmutable::setLocale($oldLocale);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user