@@ 230-257 (lines=28) @@ | ||
227 | * |
|
228 | *\_________________________________________________________/ |
|
229 | */ |
|
230 | 'leap_year' => function ($year) { |
|
231 | ||
232 | $a = 0.025; |
|
233 | ||
234 | $b = 266; |
|
235 | ||
236 | if ($year > 0) { |
|
237 | $leapDays0 = (($year + 38) % 2820)*0.24219 + $a; |
|
238 | // 0.24219 ~ extra days of one year |
|
239 | $leapDays1 = (($year + 39) % 2820)*0.24219 + $a; |
|
240 | // 38 days is the difference of epoch to 2820-year cycle |
|
241 | } elseif ($year < 0) { |
|
242 | $leapDays0 = (($year + 39) % 2820)*0.24219 + $a; |
|
243 | $leapDays1 = (($year + 40) % 2820)*0.24219 + $a; |
|
244 | } else { |
|
245 | return false; |
|
246 | } |
|
247 | ||
248 | $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
249 | $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
250 | ||
251 | if ($frac0 <= $b && $frac1 > $b) { |
|
252 | return true; |
|
253 | } else { |
|
254 | return false; |
|
255 | } |
|
256 | ||
257 | }, |
|
258 | ||
259 | /************************************************************ |
|
260 | * Weekend |
@@ 355-382 (lines=28) @@ | ||
352 | * |
|
353 | *\_________________________________________________________/ |
|
354 | */ |
|
355 | 'leap_year' => function ($year) { |
|
356 | ||
357 | $a = 0.025; |
|
358 | ||
359 | $b = 266; |
|
360 | ||
361 | if ($year > 0) { |
|
362 | $leapDays0 = (($year + 38) % 2820)*0.24219 + $a; |
|
363 | // 0.24219 ~ extra days of one year |
|
364 | $leapDays1 = (($year + 39) % 2820)*0.24219 + $a; |
|
365 | // 38 days is the difference of epoch to 2820-year cycle |
|
366 | } elseif ($year < 0) { |
|
367 | $leapDays0 = (($year + 39) % 2820)*0.24219 + $a; |
|
368 | $leapDays1 = (($year + 40) % 2820)*0.24219 + $a; |
|
369 | } else { |
|
370 | return false; |
|
371 | } |
|
372 | ||
373 | $frac0 = intval(($leapDays0 - intval($leapDays0))*1000); |
|
374 | $frac1 = intval(($leapDays1 - intval($leapDays1))*1000); |
|
375 | ||
376 | if ($frac0 <= $b && $frac1 > $b) { |
|
377 | return true; |
|
378 | } else { |
|
379 | return false; |
|
380 | } |
|
381 | ||
382 | }, |
|
383 | ||
384 | /************************************************************ |
|
385 | * Weekend |