-
Notifications
You must be signed in to change notification settings - Fork 129
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
Fix conflict between holidays and special dates #39
Conversation
Previously mix of tz-naive, "UTC" and other timezones (sometimes mixed within a specific calendar).
@@ -98,7 +98,7 @@ | |||
|
|||
# Ad hoc closes. | |||
March1BadWeather = Timestamp("2018-03-01", tz=UTC) |
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.
Does this one also need UTC removed?
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.
Thanks for getting another review in.
I left March1BadWeather
as UTC because it feeds through to special_closes_adhoc
, not adhoc_holidays
. I've added a comment to 'XDUB' to note the difference.
A side note: the suggested fix creates a DatetimeIndex of adhoc_holidays
, thereby requiring them to be defined consistently in terms of either UTC or tz-naive (at least within any specific calendar). At the risk of returning to the #42 UTC / tz-naive discussion 😀, I went with tz-naive in light of what they represent. Having worked through the implementation I was happy they could be defined in tz-naive terms (which was pretty clear anyway from the fact that some already were). Also, it didn't seem much point asking someone defining adhoc_holidays to set the timezone to UTC when that extra context isn't used (infact, as in some calendars, they could all just be defined as strings, e.g. "2021-07-09").
I didn't need to work through the workings of special_closes_adhoc
and didn't want to risk introducing a bug by changing something for the sake of changing it - allowing special_closes_adhoc
to be defined as tz-aware seemed reasonable in any case.
LGTM - |
I've added a quick test to enforce specification of It's worth noting that if someone were to mix tz-naive and UTC Hence, the only purpose of this test is to avoid someone defining all adhoc_holidays in UTC (which would not otherwise raise an error) which in turn could lead to someone else unwittingly mixing them again. |
Hi @gerrymanoim, is there anything outstanding here or would you be happy to merge with the added test? I've been holding off on PRs for the |
@maread99 So sorry - work has been super busy lately. Appreciate all the work you've been doing, thanks! |
@gerrymanoim, no worries at all, time is what it is. Thanks for merging. The other one (#54) is less involved than the number of file changes might suggest (swaps ad hoc out-of-bounds handling with a common base implementation). |
NB. Vast majority of changes relate to regularizing timezone of adhoc_holiday dates (23431fe)
Fixes #33 by allowing special closes / opens to be defined for dates that are holidays and then filtering out these conflicts in
ExchangeCalendar._special_dates
Regularizes
adhoc_holiday
dates as tz-naive (previously a mix of tz-naive, "UTC", "Asia/Jerusalem" and defined on one calendar as list of Holiday instances).- [ ] If merged and #54 merged then remove extensions ofEDIT: moved to #54test_start_bound
and/ortest_end_bound
tests marked xfail on test_xist_calendar, test_xkls_calendar and test_xnys_calendar.