mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-13 02:28:41 +00:00
Year bug fix
This commit is contained in:
parent
e16473d18e
commit
6bedad3d57
|
|
@ -91,7 +91,7 @@ class SmartDateTime extends \DateTime
|
|||
public function smartModify(int $y, int $m = 0, int $d = 0, int $calendar = CAL_GREGORIAN) : SmartDateTime
|
||||
{
|
||||
$y_change = floor(((int) $this->format('m') + $m) / 12);
|
||||
$y_change = ((int) $this->format('m') + $m) < 0 && ((int) $this->format('m') + $m) % 12 === 0 ? $y_change - 1 : $y_change;
|
||||
$y_change = ((int) $this->format('m') + $m) <= 0 && ((int) $this->format('m') + $m) % 12 === 0 ? $y_change - 1 : $y_change;
|
||||
$y_new = (int) $this->format('Y') + $y + $y_change;
|
||||
$m_new = ((int) $this->format('m') + $m) % 12;
|
||||
$m_new = $m_new === 0 ? 12 : $m_new < 0 ? 12 + $m_new : $m_new;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user