I am trying to get the number of LaserSheets cut per day to use in a chart.
pages_controller.rb:
start_date = 7.days.ago
recent_cut_stats = LaserSheet.where('cut_at IS NOT NULL')
.where('cut_at > ?', start_date.beginning_of_day)
.group("DATE(cut_at)")
.count
I am running into problems because the rest of my site uses the time zone set in application.rb
, but the above query returns results grouped by date in UTC time. After 5:00pm PDT (UTC -0700) I start seeing results for tomorrow. Is there a way to convert group("Date(cut_at)"
to the application's time zone?