mirror of
https://github.com/Hopiu/xapian-haystack.git
synced 2026-04-11 02:30:59 +00:00
Fix for date facet when gap by month amount is larger than 1
This commit is contained in:
parent
f1b7c04c12
commit
3752844e4a
1 changed files with 3 additions and 2 deletions
|
|
@ -640,9 +640,10 @@ class SearchBackend(BaseSearchBackend):
|
|||
year=date_range.year + int(gap_value)
|
||||
)
|
||||
elif gap_type == 'month':
|
||||
if date_range.month == 12:
|
||||
if date_range.month + int(gap_value) > 12:
|
||||
date_range = date_range.replace(
|
||||
month=1, year=date_range.year + int(gap_value)
|
||||
month=((date_range.month + int(gap_value)) % 12),
|
||||
year=(date_range.year + (date_range.month + int(gap_value)) / 12)
|
||||
)
|
||||
else:
|
||||
date_range = date_range.replace(
|
||||
|
|
|
|||
Loading…
Reference in a new issue