fixbug add months
This commit is contained in:
1 parent
fd2cd15339
commit
0bcfbb6062
1 file changed
+4
-12
+4
-12
@@ -2181,26 +2181,18 @@ class Verta extends DateTime {
|
|||||||
$year += intval($month / 12);
|
$year += intval($month / 12);
|
||||||
$month = $month % 12;
|
$month = $month % 12;
|
||||||
}
|
}
|
||||||
if ($month < 1) {
|
elseif ($month < 1) {
|
||||||
$year += intval($month / 12) - 1;
|
$year += intval($month / 12) - 1;
|
||||||
$month = 12 + ($month % 12);
|
$month = 12 + ($month % 12);
|
||||||
}
|
}
|
||||||
if ($value > 0) {
|
if ($value > 0) {
|
||||||
if ($month > 6 && $day == 31) {
|
if (($month > 6 && $day == 31) || ($month == 12 && $day == 30 && !self::isLeapYear($year))) {
|
||||||
$day--;
|
|
||||||
}
|
|
||||||
if ($month == 12 && !self::isLeapYear($year)) {
|
|
||||||
$day--;
|
$day--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($month == 12 && $day == 31) {
|
if (($month == 12 && $day == 31) || ($month == 12 && $day == 30)) {
|
||||||
if (self::isLeapYear($year)) {
|
$day = self::isLeapYear($year) ? 30 : 29;
|
||||||
$day = 30;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$day = 29;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return self::createJalali($year, $month, $day, $hour, $minute, $second, $this->getTimeZone());
|
return self::createJalali($year, $month, $day, $hour, $minute, $second, $this->getTimeZone());
|
||||||
|
|||||||
Reference in new issue
Block a user