khaled-alshamaa / ar-php

Set of functionalities enable Arabic website developers to serve professional search, present and process Arabic content in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hijri date correction not behaving consistently when the Hijri month end on 29th

Socotoly opened this issue · comments

Hijri date will skip 1 day when the correction value is greater than 1 and the Hijri month end on the 29th instead of the 30th.

Here's an example:
I hardcoded the date so the issue can be reproduced easily.
correction = 0

$Arabic = new \ArPHP\I18N\Arabic();
$g_date = strtotime("2022-04-02");
$hijri = $Arabic->date('j F', $g_date, 0);

output: "29 شعبان"


correction = 1

$hijri = $Arabic->date('j F', $g_date, 1);

output: "30 شعبان"


correction = 2

$hijri = $Arabic->date('j F', $g_date, 2);

output: "2 رمضان"


Thanks for finding this bug and fixing it!