add calculation year

This commit is contained in:
Nasser Hekmati committed 2017-05-02 23:15:08 +04:30
1 parent 6175fba77a
commit eea78fe25a
1 file changed
+55 -1
+55 -1
View File
@@ -889,7 +889,61 @@ class Verta extends DateTime {
}
/***************************** CONVERTION ****************************/
/***************************** CALCULATION ****************************/
/**
* Add years to the instance. Positive $value travel forward while
* negative $value travel into the past.
*
* @param int $value
*
* @return static
*/
public function addYears($value)
{
return $this->modify((int) $value.' year');
}
/**
* Add a year to the instance
*
* @param int $value
*
* @return static
*/
public function addYear($value = 1)
{
return $this->addYears($value);
}
/**
* Remove years from the instance.
*
* @param int $value
*
* @return static
*/
public function subYears($value)
{
return $this->addYears(-1 * $value)->modify('-1 day');
}
/**
* Remove a year from the instance
*
* @param int $value
*
* @return static
*/
public function subYear($value = 1)
{
return $this->subYears($value);
}
/***************************** CONVERTION ****************************/
/**
* gregorian to jalali convertion