Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: an issue causing timezone:false not to be respected #15

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/rollup/aggregator.rb
Original file line number Diff line number Diff line change
@@ -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