Skip to content

Commit

Permalink
fix: an issue causing timezone:false not to be respected
Browse files Browse the repository at this point in the history
  • Loading branch information
pelletencate committed Feb 10, 2024
1 parent dc4f68d commit 34050d5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/rollup/aggregator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def perform_group(name, column:, interval:, time_zone:, current:, last:, clear:,
raise ArgumentError, "Cannot use range and current together" if range && !current.nil?

current = true if current.nil?
time_zone ||= Rollup.time_zone
time_zone = Rollup.time_zone if time_zone.nil?

gd_options = {
current: current
Expand All @@ -68,7 +68,14 @@ def perform_group(name, column:, interval:, time_zone:, current:, last:, clear:,
# for MySQL on Ubuntu 18.04 (and likely other platforms)
if max_time.is_a?(String)
utc = ActiveSupport::TimeZone["Etc/UTC"]
max_time = Utils.date_interval?(interval) ? max_time.to_date : utc.parse(max_time).in_time_zone(time_zone)
max_time =
if Utils.date_interval?(interval)
max_time.to_date
else
t = utc.parse(max_time)
t = t.in_time_zone(time_zone) if time_zone
t
end
end

# aligns perfectly if time zone doesn't change
Expand Down

0 comments on commit 34050d5

Please sign in to comment.