Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
ErfanBahramali opened this issue Jan 11, 2024 · 2 comments

Comments

@ErfanBahramali
Copy link

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

@morilog
Copy link
Owner

morilog commented Apr 30, 2024

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

@ErfanBahramali
Copy link
Author

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants