|
@@ 2220-2234 (lines=15) @@
|
| 2217 |
|
if ($woy == 1) { // FIRST WEEK --------------------------------- |
| 2218 |
|
|
| 2219 |
|
// nextFirst is now the localized DOW of Jan 1 of y-woy+1 |
| 2220 |
|
if (($nextFirst > 0) && // Jan 1 starts on FDOW |
| 2221 |
|
(7 - $nextFirst) >= $this->getMinimalDaysInFirstWeek() // or enough days in the week |
| 2222 |
|
) { |
| 2223 |
|
// Jan 1 of (yearWoy+1) is in yearWoy+1 - recalculate JD to next year |
| 2224 |
|
$julianDay = $nextJulianDay; |
| 2225 |
|
|
| 2226 |
|
// recalculate 'first' [0-based local dow of jan 1] |
| 2227 |
|
$first = $this->julianDayToDayOfWeek($julianDay + 1) - $firstDayOfWeek; |
| 2228 |
|
if ($first < 0) { |
| 2229 |
|
$first += 7; |
| 2230 |
|
} |
| 2231 |
|
// recalculate date. |
| 2232 |
|
$date = 1 - $first + $dowLocal; |
| 2233 |
|
} |
| 2234 |
|
} elseif ($woy >= $this->getLeastMaximum($bestField)) { |
| 2235 |
|
// could be in the last week- find out if this JD would overstep |
| 2236 |
|
$testDate = $date; |
| 2237 |
|
if ((7 - $first) < $this->getMinimalDaysInFirstWeek()) { |
|
@@ 2244-2254 (lines=11) @@
|
| 2241 |
|
// Now adjust for the week number. |
| 2242 |
|
$testDate += 7 * ($woy - 1); |
| 2243 |
|
|
| 2244 |
|
if ($julianDay + $testDate > $nextJulianDay) { // is it past Dec 31? (nextJulianDay is day BEFORE year+1's Jan 1) |
| 2245 |
|
// Fire up the calculating engines.. retry YWOY = (year-1) |
| 2246 |
|
$julianDay = $this->handleComputeMonthStart($year - 1, 0, false); // jd before Jan 1 of previous year |
| 2247 |
|
$first = $this->julianDayToDayOfWeek($julianDay + 1) - $firstDayOfWeek; // 0 based local dow of first week |
| 2248 |
|
|
| 2249 |
|
if ($first < 0) { // 0..6 |
| 2250 |
|
$first += 7; |
| 2251 |
|
} |
| 2252 |
|
$date = 1 - $first + $dowLocal; |
| 2253 |
|
} /* correction needed */ |
| 2254 |
|
} /* leastmaximum */ |
| 2255 |
|
} /* resolvefields(year) != year_woy */ |
| 2256 |
|
} /* bestfield != week_of_year */ |
| 2257 |
|
|