Giter Site home page Giter Site logo

Comments (4)

kylekatarnls avatar kylekatarnls commented on June 29, 2024

Hello,

As of now, alternative calendars (Hijri/Jewish/Lunar) are not compatible with conditional syntax.

I started a fix, you can try it by requiring:

"require": {
  ...
  "cmixin/business-day": "dev-fix/issue-84-support-alt-calendar-with-conditions as 1.14.0"
}

As it involves one more RegExp parsing, it might cost some performance so I still have to find a more optimized way.

from business-day.

betaSavvy avatar betaSavvy commented on June 29, 2024

@kylekatarnls

Wow that was quick! Just did some test with it and working good so far. Nice work!

Then went on to test another holiday - Hari Raya Haji(aka Eid al-Adha) which falls on the 10th day of the 12th month in the Islamic calendar.

return [
    'hari-raya-haji' => '= 10 dhu al-hijjah if sunday then next monday', 
]

I tried from year 2000-2021, the following years gave me error in test cases.

2004-02-01, 2007-12-27, 2008-12-08, 2009-11-27, 2011-11-06, 2016-09-12, 2019-08-11

I am referencing this source for the particular holiday I am testing Singapore Public Holidays

and this for the hijri/gregorian calendar Islamic/Gregorian Calendar

Any idea why this happens?

from business-day.

kylekatarnls avatar kylekatarnls commented on June 29, 2024

Can you please add '= 10 dhu al-hijjah' in your config and check: Carbon::getYearHolidays() for each year and for each day what day of week it is, so I can see if either 10 dhu al-hijjah (based on Hijri calendar) is the mismatch or if the if-then rule fails. Thanks 🙏

from business-day.

betaSavvy avatar betaSavvy commented on June 29, 2024
Hari Raya Haji: 16/03/2000 Thursday
Hari Raya Haji: 06/03/2001 Tuesday
Hari Raya Haji: 23/02/2002 Saturday
Hari Raya Haji: 12/02/2003 Wednesday
Hari Raya Haji: 02/02/2004 Monday         // this should be observed, actual is 01/02/2004 Sunday
Hari Raya Haji: 21/01/2005 Friday
Hari Raya Haji: 10/01/2006 Tuesday
Unknown: 31/12/2006 Sunday                // No idea about this, the id is hari-raya-haji-oc-2
Hari Raya Haji: 20/12/2007 Thursday       // actual should be is 27/12/2007 Thursday
Hari Raya Haji: 09/12/2008 Tuesday        // actual should be is 08/12/2008 Monday
Hari Raya Haji: 28/11/2009 Saturday       // actual should be is 27/11/2008 Friday
Hari Raya Haji: 17/11/2010 Wednesday
Hari Raya Haji: 07/11/2011 Monday         // this should be observed, actual is 06/11/2011 Thursday
Hari Raya Haji: 26/10/2012 Friday
Hari Raya Haji: 15/10/2013 Tuesday
Hari Raya Haji: 05/10/2014 Sunday
Hari Raya Haji (observed): 06/10/2014 Monday
Hari Raya Haji: 24/09/2015 Thursday
Hari Raya Haji: 13/09/2016 Tuesday        // actual should be is 12/09/2016 Monday
Hari Raya Haji: 02/09/2017 Saturday
Hari Raya Haji: 22/08/2018 Wednesday
Hari Raya Haji: 12/08/2019 Monday         // this should be observed, actual is 11/08/2019 Thursday
Hari Raya Haji: 31/07/2020 Friday
Hari Raya Haji: 20/07/2021 Tuesday

The above data(2000 - 2021) is based on the following config:

return [
    'hari-raya-haji' => '= 10 dhu al-hijjah',
    'hari-raya-haji-observed' => '= 10 dhu al-hijjah if sunday then next monday',
];

Year 2014 works correctly with both holiday and observed holiday.

from business-day.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.