-
Notifications
You must be signed in to change notification settings - Fork 803
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 year interval for DateHistogramFacet #1502
Add year interval for DateHistogramFacet #1502
Conversation
Is there anything I can do to make this merged? |
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 this, one comment for you:
elasticsearch_dsl/faceted_search.py
Outdated
@@ -168,6 +168,10 @@ def get_value_filter(self, filter_value): | |||
) | |||
|
|||
|
|||
def _date_interval_year(d): | |||
return (d + timedelta(days=366)).replace(day=1) |
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.
Let's change this to return d.replace(year=d.year+1, day=(28 if d.month == 2 and d.day == 29 else d.day))
since years are linear unlike months.
We should add a test case for leap day handling as well (Basically see that February 29th, 2020 increments to February 28th, 2021)
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.
Done. Updated to return d.replace(year=d.year+1, day=(28 if d.month == 2 and d.day == 29 else d.day))
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.
LGTM
Thank you |
Added
year
interval for DateHistogramFacet.Closes #1501