fix timezone - time with local timezone to default timezone

This commit is contained in:
pyaephyoeaung
2022-05-19 14:20:55 +06:30
parent 7598a96e60
commit 214712fd2d
48 changed files with 294 additions and 305 deletions

View File

@@ -31,38 +31,38 @@ class BaseReportController < ActionController::Base
period = params[:period]
if params[:from].present? && params[:to].present?
from = Time.parse(params[:from])
to = Time.parse(params[:to])
from = Time.zone.parse(params[:from])
to = Time.zone.parse(params[:to])
else
case period.to_i
when PERIOD["today"]
from = Time.now
to = Time.now
from = Time.current
to = Time.current
when PERIOD["yesterday"]
from = 1.day.ago
to = 1.day.ago
when PERIOD["this_week"]
from = Time.now.beginning_of_week
to = Time.now
from = Time.current.beginning_of_week
to = Time.current
when PERIOD["last_week"]
from = 1.week.ago.beginning_of_week
to = 1.week.ago.end_of_week
when PERIOD["last_7"]
from = 7.day.ago
to = Time.now
to = Time.current
when PERIOD["this_month"]
from = Time.now.beginning_of_month
to = Time.now
from = Time.current.beginning_of_month
to = Time.current
when PERIOD["last_month"]
from = 1.month.ago.beginning_of_month
to = 1.month.ago.end_of_month
when PERIOD["last_30"]
from = 30.day.ago
to = Time.now
to = Time.current
when PERIOD["this_year"]
from = Time.now.beginning_of_year
to = Time.now
from = Time.current.beginning_of_year
to = Time.current
when PERIOD["last_year"]
from = 1.year.ago.beginning_of_year
to = 1.year.ago.end_of_year