Skip to content

Commit

Permalink
Fix before:, after: and during: failing when time zone not set (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and vmstan committed Jan 5, 2024
1 parent 4aa7598 commit 21d418e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/lib/search_query_transformer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ def initialize(prefix, operator, term, options = {})
when 'before'
@filter = :created_at
@type = :range
@term = { lt: term, time_zone: @options[:current_account]&.user_time_zone || 'UTC' }
@term = { lt: term, time_zone: @options[:current_account]&.user_time_zone.presence || 'UTC' }
when 'after'
@filter = :created_at
@type = :range
@term = { gt: term, time_zone: @options[:current_account]&.user_time_zone || 'UTC' }
@term = { gt: term, time_zone: @options[:current_account]&.user_time_zone.presence || 'UTC' }
when 'during'
@filter = :created_at
@type = :range
@term = { gte: term, lte: term, time_zone: @options[:current_account]&.user_time_zone || 'UTC' }
@term = { gte: term, lte: term, time_zone: @options[:current_account]&.user_time_zone.presence || 'UTC' }
else
raise "Unknown prefix: #{prefix}"
end
Expand Down

0 comments on commit 21d418e

Please # to comment.