vacanza / python-holidays

Generate and work with holidays in Python
https://pypi.org/project/holidays
MIT License
1.4k stars 447 forks source link

India - Optional Holiday and Other Holidays which depend on Lunar dates #413

Open rishabmehta7 opened 3 years ago

rishabmehta7 commented 3 years ago

Hi Guys,

Is there an option to specify optional holidays based or religion? To give you an example Christmas is a public holiday irrespective of the religion, but something like 'Mahaveer Jayanti' is a holiday for 'Jains' (People following Jainism). Similarly there are plenty of examples for Hindus, Sikhs, Muslims etc.

Also most of these very much depend on lunar dates and not on Georgian calendar. Is there a library that you are aware of that can provide the correct phase of moon? I can use those to specify the other major Holidays in India.

Rishab

xames3 commented 2 years ago

I would like to work on and submit a patch for an Indian holiday for 19th Feb, which is Shivaji Jayanti in Maharashtra, India. Is it fine if I submit a patch as part of this PR?

mborsetti commented 2 years ago

I would like to work on and submit a patch for an Indian holiday for 19th Feb, which is Shivaji Jayanti in Maharashtra, India. Is it fine if I submit a patch as part of this PR?

@xames3 PRs are always welcomed! Just start a new PR (this one here is an issue to begin with) with the code.

mborsetti commented 2 years ago

Rashid,

Is there an option to specify optional holidays based or religion? To give you an example Christmas is a public holiday irrespective of the religion, but something like 'Mahaveer Jayanti' is a holiday for 'Jains' (People following Jainism). Similarly there are plenty of examples for Hindus, Sikhs, Muslims etc.

That's an interesting use case and for the moment only states or provinces are allowed, but of course code could be modified.

Also most of these very much depend on lunar dates and not on Georgian calendar. Is there a library that you are aware of that can provide the correct phase of moon? I can use those to specify the other major Holidays in India.

We already import the convertdate package and it appears to handle Indian civil calendar dates.

rishabmehta7 commented 2 years ago

You got my name wrong 😕

I'll look at the Chinese calendar and see how similar or not it is to Indian Calendar.

Thanks

On Fri, 8 Oct, 2021, 4:52 am Mike Borsetti, @.***> wrote:

Rashid,

Is there an option to specify optional holidays based or religion? To give you an example Christmas is a public holiday irrespective of the religion, but something like 'Mahaveer Jayanti' is a holiday for 'Jains' (People following Jainism). Similarly there are plenty of examples for Hindus, Sikhs, Muslims etc.

That's an interesting use case and for the moment only states or provinces are allowed, but of course code could be modified.

Also most of these very much depend on lunar dates and not on Georgian calendar. Is there a library that you are aware of that can provide the correct phase of moon? I can use those to specify the other major Holidays in India.

There's now a lunar calendar function in the utils module. It is based on the Chinese lunar calendar, and I am not familiar enough to know if the Indian calendar is any different.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dr-prodigy/python-holidays/issues/413#issuecomment-938222588, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5X3XXK3HD6HZ67NEZF7ATUFYTRZANCNFSM4V2BDHBQ .

mborsetti commented 2 years ago

You got my name wrong 😕

Whoops, may apologies Rishab!

I'll look at the Chinese calendar and see how similar or not it is to Indian Calendar.

Actually, I edited my response to "we already import the convertdate package and it appears to handle Indian civil calendar dates."

Thanks for your looking into contributing to this project!

dr-prodigy commented 2 years ago

Hi @rishabmehta7 sorry for getting to this so late. At the current time, religious holidays are not taken into account by python-holidays, so an improvement like this, although meaningful, is out of the current scope of the lib, so it would ask for a similar review for every supported country.

Due to this, I consider it as a long running (and low-priority) task, but if you wish to work on it for India, we will later consider it / review it as a global lib improvement.

Thanks! 👍

arkid15r commented 7 months ago

PH supports more granular holidays definition based on region/category/special or regular status now. It should be much easier to implement those holidays support atm.