Files
SIRH/src/Util/LeaveRecapCutoff.php
tristan 0897154460
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
feat : ajout d'un écran pour le récap congés et RTT
2026-04-14 15:08:45 +02:00

24 lines
599 B
PHP

<?php
declare(strict_types=1);
namespace App\Util;
use DateTimeImmutable;
/**
* Leave recap cutoff rule: as-of end of ISO week S-2 (Sunday 23:59:59).
*
* Example: Tuesday 2026-04-14 (S16) → Sunday 2026-04-05 23:59:59 (end of S14).
*/
final class LeaveRecapCutoff
{
public static function resolveCutoff(DateTimeImmutable $today): DateTimeImmutable
{
$currentWeekMonday = $today->modify('monday this week')->setTime(0, 0);
$cutoffWeekMonday = $currentWeekMonday->modify('-14 days');
return $cutoffWeekMonday->modify('+6 days')->setTime(23, 59, 59);
}
}