Closed smhnaqvi closed 6 years ago
what kind of problems? please give me some examples.
lets take an example :
i wrote this code
jdate(); // output : 1397-08-02 11:00:00
but when i wrote this code - you can see result in bottom
jdate()->subMonths(1); // output : 1398-02-03 11:00:00
i think that it doesn't work correctly
I wrote a test in local with this lines:
$jDate = Jalalian::fromFormat('Y-m-d H:i:s', '1397-08-02 11:00:00');
$this->assertEquals('1397-07-02', $jDate->subMonths()->format('Y-m-d'));
and it was passed!
maybe you installed old version of this package and get wrong results
yeah , you're right i figure out that why i got it because of beberlei/assert's version i had beberlei/assert dev-master so composer installed morilog/jalali version 3.0.7 so i removed it and then i reinstalled morilog/jalali it installed last version of morilog (3.0.12) and now i don't have this issues , tnx
Hello dear,
Algorithm of the
subMonths()
function has a problem for subtracting months which results a date in previous year.I propose you a simple implementation as follow: