@@ -1629,8 +1629,6 @@ def search_allocations(
16291629 assert start
16301630 assert end
16311631
1632- start , end = self ._prepare_range (start , end )
1633-
16341632 assert whole_day in ('yes' , 'no' , 'any' )
16351633 assert groups in ('yes' , 'no' , 'any' )
16361634
@@ -1645,7 +1643,7 @@ def search_allocations(
16451643 else :
16461644 day_numbers = None
16471645
1648- query = self .allocations_in_range (start , end )
1646+ query = self .allocations_in_range (* self . _prepare_range ( start , end ) )
16491647 query = query .order_by (Allocation ._start )
16501648
16511649 allocations = []
@@ -1657,13 +1655,19 @@ def search_allocations(
16571655
16581656 if not self .is_allocation_exposed (allocation ):
16591657 continue
1660-
1661- s = datetime .combine (allocation .start .date (), start .time ())
1662- e = datetime .combine (allocation .end .date (), end .time ())
1663-
1664- # the raw dates will be UTC
1665- s = sedate .replace_timezone (s , 'UTC' )
1666- e = sedate .replace_timezone (e , 'UTC' )
1658+ allocation_start = allocation .display_start ()
1659+ # NOTE: We want the correct timezone, but we don't want the
1660+ # date to be on the next day for a full-day reservation
1661+ # so we skip the microsecond addition
1662+ allocation_end = sedate .to_timezone (allocation .end , self .timezone )
1663+ s = sedate .standardize_date (datetime .combine (
1664+ allocation_start .date (),
1665+ start .time ()
1666+ ), self .timezone )
1667+ e = sedate .standardize_date (datetime .combine (
1668+ allocation_end .date (),
1669+ end .time ()
1670+ ), self .timezone )
16671671
16681672 if not allocation .overlaps (s , e ):
16691673 continue
0 commit comments