chore: Timezone fixes for ReportBuilder and for ReportController spec (#4246)

- ReportBuilder wasn't using the specified time zone for the timestamp in the
"build" method
- The ReportController spec was calling `Time.zone.today.to_time`, but
`Date#to_time` disregards the zone from `Time.zone` and reverts to the system
time zone.
This commit is contained in:
Jordan Brough
2022-03-25 02:30:27 -06:00
committed by GitHub
parent 6bfe0f2fc1
commit a8cfcbc168
2 changed files with 43 additions and 29 deletions

View File

@@ -19,7 +19,7 @@ class V2::ReportBuilder
# For backward compatible with old report
def build
timeseries.each_with_object([]) do |p, arr|
arr << { value: p[1], timestamp: p[0].to_time.to_i }
arr << { value: p[1], timestamp: p[0].in_time_zone(@timezone).to_i }
end
end