jalali icon indicating copy to clipboard operation
jalali copied to clipboard

Assert\InvalidArgumentException: Provided "30" is neither greater than or equal to "1" nor less than or equal to "29".

Open ErfanBahramali opened this issue 1 year ago • 2 comments

Hi

Apparently, there are problems in calculating the past time

  • Package Version: 3.4

Code:

use Morilog\Jalali\Jalalian;

$date = Jalalian::fromDateTime('2009-03-20 00:00:00');
$result = $date->subYears(1);

// or

(new Jalalian(1387, 12, 30))->subYears(1);

Result:

image

ErfanBahramali avatar Jan 11 '24 02:01 ErfanBahramali

Its because of your input, ESFAND at 1387 has not 30 days

morilog avatar Apr 30 '24 07:04 morilog

Its because of your input, ESFAND at 1387 has not 30 days

OK, so 365 days before should be calculated It should not give an error

ErfanBahramali avatar Apr 30 '24 16:04 ErfanBahramali