FIX: Fecha comparación para terreno a fin de diciembre

This commit is contained in:
Juan Pablo Vial
2024-11-20 17:11:03 -03:00
parent 1e2bd617fa
commit 54f3b95b88

View File

@ -33,7 +33,7 @@ class Terreno extends Ideal\Service
try {
$proyecto = $this->proyectoRepository->fetchById($proyecto_id);
$today = new DateTimeImmutable();
$lastDecember = (new DateTimeImmutable($today->format('Y-01-01')))->sub(new DateInterval('P1M'));
$lastDecember = (new DateTimeImmutable($today->format('Y-01-31')))->sub(new DateInterval('P1M'));
if ($proyecto->terreno->fecha >= $lastDecember) {
return $proyecto->terreno;
}