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
Add Hong Kong calendar. Factor out the Christmas/Boxing Day Sunday s… #235
Conversation
…ift as its used in the UK and in HK. Add a test to Poland as an example to ensure it *doesn't* shift countries which don't shift Christmas. Add complicated Sunday shift for the third day of CNY - I would rather loop this than hardcode it, but I didn't want to change the core approach until it had been discussed.
…r before the PR (hence why I split it)? Probably something obvious I missed.
It's weird to have all these changes at once, but it looks fine: thanks to our tests, it's obvious that you didn't break a thing! Don't worry about the fact that it's "hardcoded" in some way, we can refactor this bit later on. |
Yeah sorry I'll try to break things up better going forward.
…On Mon, 26 Jun 2017 at 16:17, Bruno Bord ***@***.***> wrote:
It's weird to have all these changes at once, but it looks fine: thanks to
our tests, it's obvious that you didn't break a thing!
Don't worry about the fact that it's "hardcoded" in some way, we can
refactor this bit later on.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#235 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATTDfOXDVWVgce0G47CNBx28f_jgHO7Rks5sH2k3gaJpZM4OEk6o>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor changes, overall I think it fixes the "D.R.Y." problem and you're adding a valuable new calendar!
@@ -327,6 +327,19 @@ def get_whit_sunday(self, year): | |||
def get_corpus_christi(self, year): | |||
return self.get_easter_sunday(year) + timedelta(days=60) | |||
|
|||
def shift_christmas_boxing_days(self, year): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can add a docstring here, for more clarity. it's not a blocking point, though
workalendar/core.py
Outdated
if christmas.weekday() in self.get_weekend_days(): | ||
shift = self.find_following_working_day(christmas) | ||
results.append((shift, "Christmas Shift")) | ||
results.append((shift + timedelta(days=1), "Boxing Day Shift")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see the following label here: "{} Shift".format(self.boxing_day_label)
In some countries, Boxing Day is named "St Stephen's" or "The Day After Christmas", for example
workalendar/core.py
Outdated
results.append((shift + timedelta(days=1), "Boxing Day Shift")) | ||
elif boxing_day.weekday() in self.get_weekend_days(): | ||
shift = self.find_following_working_day(boxing_day) | ||
results.append((shift, "Boxing Day Shift")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
…1, if CNY started on a Sunday it was rolled to a Saturday. This was changed in 2011 since most people had Sat off anyone, and so they made it the following Wed. How very kind of them. Also captured the edge case when chingming falls on the same day as another holiday (most likely a Christian variable holiday such as Easter).
…o hong-kong * 'master' of https://github.com/novafloss/workalendar: Splitted `africa.py` file into an `africa/` module
Hey - sorry for the delay, real life got in the way ;-) OK I've done the requested changes, plus also fixed a couple of other edge cases I found while researching the Hong Kong calendar (see commit message for details). |
Thanks a lot for this contribution! |
My pleasure! I look forward to being able to contribute more. |
…hift as its used in the UK and in HK. Add a test to Poland as an example to ensure it doesn't shift countries which don't shift Christmas. Add complicated Sunday shift for the third day of CNY - I would rather loop this than hardcode it, but I didn't want to change the core approach until it had been discussed.
refs #
For information, read and make sure you're okay with the CONTRIBUTING document.
<country>
by@pseudo
(#)"