| @@ 406-441 (lines=36) @@ | ||
| 403 | * |
|
| 404 | * @return object |
|
| 405 | */ |
|
| 406 | public function add($value) |
|
| 407 | { |
|
| 408 | ||
| 409 | $this->date_interval_expression = str_replace( |
|
| 410 | $this->config['date_simple'], |
|
| 411 | $this->config['date_interval'], |
|
| 412 | $value |
|
| 413 | ); |
|
| 414 | ||
| 415 | $unit = 'P'; |
|
| 416 | ||
| 417 | if (strpos($this->date_interval_expression, 'T')) { |
|
| 418 | $this->date_interval_expression = str_replace( |
|
| 419 | 'T', |
|
| 420 | '', |
|
| 421 | $this->date_interval_expression |
|
| 422 | ); |
|
| 423 | ||
| 424 | $unit = 'PT'; |
|
| 425 | } |
|
| 426 | ||
| 427 | $this->date_interval_expression = str_replace( |
|
| 428 | ' ', |
|
| 429 | '', |
|
| 430 | $unit.$this->date_interval_expression |
|
| 431 | ); |
|
| 432 | ||
| 433 | $this->date_time->add( |
|
| 434 | new DateInterval($this->date_interval_expression) |
|
| 435 | ); |
|
| 436 | ||
| 437 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
|
| 438 | ||
| 439 | return $this; |
|
| 440 | ||
| 441 | } |
|
| 442 | ||
| 443 | /** |
|
| 444 | * Sub date from current date |
|
| @@ 450-485 (lines=36) @@ | ||
| 447 | * |
|
| 448 | * @return obejct |
|
| 449 | */ |
|
| 450 | public function sub($value) |
|
| 451 | { |
|
| 452 | ||
| 453 | $this->date_interval_expression = str_replace( |
|
| 454 | $this->config['date_simple'], |
|
| 455 | $this->config['date_interval'], |
|
| 456 | $value |
|
| 457 | ); |
|
| 458 | ||
| 459 | $unit = 'P'; |
|
| 460 | ||
| 461 | if (strpos($this->date_interval_expression, 'T')) { |
|
| 462 | $this->date_interval_expression = str_replace( |
|
| 463 | 'T', |
|
| 464 | '', |
|
| 465 | $this->date_interval_expression |
|
| 466 | ); |
|
| 467 | ||
| 468 | $unit = 'PT'; |
|
| 469 | } |
|
| 470 | ||
| 471 | $this->date_interval_expression = str_replace( |
|
| 472 | ' ', |
|
| 473 | '', |
|
| 474 | $unit.$this->date_interval_expression |
|
| 475 | ); |
|
| 476 | ||
| 477 | $this->date_time->sub( |
|
| 478 | new DateInterval($this->date_interval_expression) |
|
| 479 | ); |
|
| 480 | ||
| 481 | $this->gregorian_DayofWeek = $this->date_time->format('w'); |
|
| 482 | ||
| 483 | return $this; |
|
| 484 | ||
| 485 | } |
|
| 486 | ||
| 487 | /** |
|
| 488 | * Check if current year is leap or not |
|