From 34050d53ee81929264fb0818262b8d99f24b1ada Mon Sep 17 00:00:00 2001 From: Pelle ten Cate Date: Sat, 10 Feb 2024 01:05:42 +0100 Subject: [PATCH] fix: an issue causing timezone:false not to be respected --- lib/rollup/aggregator.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/rollup/aggregator.rb b/lib/rollup/aggregator.rb index 3eaf44e..c405cb0 100644 --- a/lib/rollup/aggregator.rb +++ b/lib/rollup/aggregator.rb @@ -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 @@ -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