fix: correctly calculate due dates for contract and invoice uploads
This commit is contained in:
@@ -233,6 +233,14 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
$dueDateFrom = $this->getCreatedAt()->modify(sprintf('+%d days', $deadlineDays));
|
||||
$dueDateTo = $assignmentPeriod->end->modify('-1 day');
|
||||
|
||||
// A short-notice assignment can end before the normal $deadlineDays window would even
|
||||
// start. Left uncapped, dueDateFrom >= dueDateTo makes isStarted() and isEnded() equal
|
||||
// at every instant below, so the flag would never light up; treat the contract as due
|
||||
// right away instead.
|
||||
if ($dueDateFrom >= $dueDateTo) {
|
||||
$dueDateFrom = $this->getCreatedAt();
|
||||
}
|
||||
|
||||
$period = CarbonPeriodImmutable::create($dueDateFrom, $dueDateTo);
|
||||
|
||||
// isStarted() alone stays true once the period has begun, so the dashboard kept
|
||||
|
||||
Reference in New Issue
Block a user