honzajavorek / czech-holidays

Czech holidays on PyPI
https://pypi.python.org/pypi/czech-holidays
MIT License
15 stars 2 forks source link

Provide some historical data #15

Open encukou opened 2 years ago

encukou commented 2 years ago

pyvo.cz uses czech-holidays on its calendar of historical meetups. (Though the CSS for holidays is missing - that's a bug...) I suggest to:

(This is low priority for me. If you agree with the changes, I'll send a PR some time when this bothers me too much.)

honzajavorek commented 2 years ago

 IMO the library should support years since a particular hard-coded year, not “current only".

Perhaps I don't understand the sentence correctly or there is a bug, but I think what you suggest should be the case now. The intended behavior is to generate holidays for any year equal to or following 2016 (last legislative change), assuming it has the same, current holiday scheme. For years before 2016 it should raise an exception. So the hard-coded year is 2016.

Add data for 2010+

I'd need to restructure the library so that it supports historical holiday schemes. If the hard-coded year changes to 2010 or so, that would result in at least two holiday schemes. Those are quite similar, so that's probably doable. It would make https://github.com/honzajavorek/czech-holidays/issues/14 difficult or incomplete though, but that's still probably doable.

TBH I struggle to read through the wall of text in https://cs.wikipedia.org/wiki/%C4%8Cesk%C3%BD_st%C3%A1tn%C3%AD_sv%C3%A1tek so that I could figure out when exactly did the previous holiday scheme start, so that I know when was the last previous legislative „breaking change“ to the scheme. So if anyone can do this, that would be much appreciated as a contribution.

 It's what is done for future years anyway!

That's a good point. Future years are just assumed to fall into the current scheme. Still I think it makes sense to:

1) Assume current scheme for future. If legislative change happens, add new scheme, bump a major version of the library and release a breaking change. 2) Support generating holidays for all years since \<year of the last legislative change before 2015>. Keep track of historical schemes within that period.

The 2) would even allow for contributions from history fans like @Edelstadt, who could potentially, if they wished, add schemes for even more ancient times, pushing the hardcoded year step by step more to the past.

honzajavorek commented 6 months ago

Thinking about deprecating this library in favor of the holidays library. Would holidays solve your issue?