24 lines
599 B
PHP
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);
|
|
}
|
|
}
|