Skip to content

Here is the code and issue with calculation using your functions #45

New issue

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

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

Already on GitHub? Sign in to your account

Open
akathuria2015 opened this issue Mar 4, 2024 · 0 comments
Open

Comments

@akathuria2015
Copy link

          Here is the code and issue with calculation using your functions

Below is the code to add the year month day to Ethiopian date of 07/03/2016 in the format of dd/mm/yyyy
$et = '07/03/2016'; // Ethiopic date string in dd/mm/yyyy format
[$day, $month, $year] = explode('/', $et); // split it by the delimiter

    $date = Andegna\DateTimeFactory::of($year, $month, $day);

    $sentencedate =$date->add(new \DateInterval('P1Y3M15D'));

    //$sentencedate = $date->modify('+15 days +3 months +1 year');

    //$sentencedate = $sentencedate->modify('-1 day');
    dd($sentencedate); 

output of this code is 25/06/2017 which is wrong as it does not take into account the Ethiopian months are 30 days for 12 months and the 13th month is 5 or 6 days depending on the leap year. if you take this into account the correct 17/06/2017. how can I solve this using PHP. This date of 07/03/2016 can be any date entered by the user in Ethiopian format

Originally posted by @akathuria2015 in #44 (comment)

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

No branches or pull requests

1 participant