= date('Y-m-d', strtotime('-1 day')) ? $end : date('Y-m-d', strtotime('-1 day')); // Carried on from its last day, on the day of the month it started; from today, a term from today $new_end = contractNextEnd($from, $contract['contract_term_months'], $from === $end ? contractAnchorDay($contract) : 0); ?>