Display local time in the browser
This commit is contained in:
@@ -99,15 +99,17 @@ class AnalyticsController < ApplicationController
|
||||
.group("DATE_TRUNC('hour', timestamp)")
|
||||
.count
|
||||
|
||||
# Convert to chart format
|
||||
# Convert to chart format - keep everything in UTC for consistency
|
||||
timeline_data = (0..23).map do |hour_ago|
|
||||
hour_time = hour_ago.hours.ago
|
||||
hour_key = hour_time.strftime("%Y-%m-%d %H:00:00")
|
||||
hour_key = hour_time.utc.beginning_of_hour
|
||||
|
||||
{
|
||||
time: hour_time.strftime("%H:00"),
|
||||
# Store as ISO string for JavaScript to handle timezone conversion
|
||||
time_iso: hour_time.iso8601,
|
||||
total: events_by_hour[hour_key] || 0
|
||||
}
|
||||
end.reverse
|
||||
end
|
||||
|
||||
# Action distribution for pie chart
|
||||
action_distribution = @event_breakdown.map do |action, count|
|
||||
|
||||
Reference in New Issue
Block a user