morilog / jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in php appliations, based on Jalali (Shamsi) DateTime class.
MIT License
856 stars 111 forks source link

Maximum years supported in jalali is lower than 1416-10-30 #110

Closed amirhs712 closed 3 years ago

amirhs712 commented 3 years ago

Setting a date after 1416-10-30 would result in 1348-10-11 (1970).

Steps to reproduce:

\Morilog\Jalali\Jalalian::fromFormat('Y-m-d', '1416-12-01')

Using version 3.1.2 of the package.

I need support for years bigger than 1416.

morilog commented 3 years ago

I wrote a test for it and it works properly https://github.com/morilog/jalali/blob/7c3434548ecee790e894227e4717f895c0d3cd8d/tests/JalalianTest.php#L113

amirhs712 commented 3 years ago

I ran your tests using PHPUnit 4.8.36 and PHP 7.2.7 (Zend engine 3.2.0) which failed and behaved exactly as I described in the beginning.

But running the code using PHP 7.4.3 (Zend engine 3.4.0) was successful. However I downloaded the latest PHP 7.2.7 (2020 version)(Zend engine 3.2.0) and ran the tests again with the same exact config and it passed.

I'm not sure what would be causing this issue.

morilog commented 3 years ago

I updated the travis.ci for running tests over major versions of PHP and all of them were passed