@@ -116,7 +116,7 @@ |
||
116 | 116 | $day = $cal->toDateTime(); |
117 | 117 | $day->modify($direction . ' ' . $modifiedDay); |
118 | 118 | $cal->setTime($day->getTimestamp() * 1000); |
119 | - $cal2 = clone $this->calendar; |
|
119 | + $cal2 = clone $this->calendar; |
|
120 | 120 | $cal2->setTime($dateTime->getTimestamp() * 1000); |
121 | 121 | |
122 | 122 | if (null !== $this->year && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) { |
@@ -95,34 +95,34 @@ |
||
95 | 95 | |
96 | 96 | public function isFollowUpDay(DateTimeInterface $dateTime, string $followUpDay): bool |
97 | 97 | { |
98 | - return $this->isModifiedDate($dateTime, $followUpDay, 'next'); |
|
98 | + return $this->isModifiedDate($dateTime, $followUpDay, 'next'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | public function isPreviousDay(DateTimeInterface $dateTime, string $previousDay): bool |
102 | 102 | { |
103 | - return $this->isModifiedDate($dateTime, $previousDay, 'previous'); |
|
103 | + return $this->isModifiedDate($dateTime, $previousDay, 'previous'); |
|
104 | 104 | } |
105 | 105 | |
106 | - private function isModifiedDate(DateTimeInterface $dateTime, string $modifiedDay, string $direction): bool |
|
107 | - { |
|
108 | - $cal = clone $this->calendar; |
|
109 | - $cal = self::setGregorianYearForDate((int) $dateTime->format('Y'), $cal); |
|
110 | - $day = $cal->toDateTime(); |
|
111 | - $day->modify($direction . ' ' . $modifiedDay); |
|
112 | - $cal->setTime($day->getTimestamp() * 1000); |
|
113 | - $cal2 = clone $this->calendar; |
|
114 | - $cal2->setTime($dateTime->getTimestamp() * 1000); |
|
115 | - |
|
116 | - if (null !== $this->year && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) { |
|
117 | - return false; |
|
118 | - } |
|
119 | - |
|
120 | - if ($cal->get(IntlCalendar::FIELD_MONTH) !== $cal2->get(IntlCalendar::FIELD_MONTH)) { |
|
121 | - return false; |
|
122 | - } |
|
123 | - |
|
124 | - return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $cal2->get(IntlCalendar::FIELD_DAY_OF_MONTH); |
|
125 | - } |
|
106 | + private function isModifiedDate(DateTimeInterface $dateTime, string $modifiedDay, string $direction): bool |
|
107 | + { |
|
108 | + $cal = clone $this->calendar; |
|
109 | + $cal = self::setGregorianYearForDate((int) $dateTime->format('Y'), $cal); |
|
110 | + $day = $cal->toDateTime(); |
|
111 | + $day->modify($direction . ' ' . $modifiedDay); |
|
112 | + $cal->setTime($day->getTimestamp() * 1000); |
|
113 | + $cal2 = clone $this->calendar; |
|
114 | + $cal2->setTime($dateTime->getTimestamp() * 1000); |
|
115 | + |
|
116 | + if (null !== $this->year && $cal->get(IntlCalendar::FIELD_YEAR) !== $cal2->get(IntlCalendar::FIELD_YEAR)) { |
|
117 | + return false; |
|
118 | + } |
|
119 | + |
|
120 | + if ($cal->get(IntlCalendar::FIELD_MONTH) !== $cal2->get(IntlCalendar::FIELD_MONTH)) { |
|
121 | + return false; |
|
122 | + } |
|
123 | + |
|
124 | + return $cal->get(IntlCalendar::FIELD_DAY_OF_MONTH) === $cal2->get(IntlCalendar::FIELD_DAY_OF_MONTH); |
|
125 | + } |
|
126 | 126 | |
127 | 127 | public function getWeekdayForGregorianYear(int $year): int |
128 | 128 | { |