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

@@ -78,15 +78,15 @@ private
def get_date_range_from_params
if params[:from].present? && params[:to].present?
if params[:from_time].present? && params[:to_time].present?
from = Time.parse("#{params[:from]} #{params[:from_time]}")
to = Time.parse("#{params[:to]} #{params[:to_time]}")
from = Time.zone.parse("#{params[:from]} #{params[:from_time]}")
to = Time.zone.parse("#{params[:to]} #{params[:to_time]}")
else
from = Time.parse(params[:from])
to = Time.parse(params[:to]).end_of_day
from = Time.zone.parse(params[:from])
to = Time.zone.parse(params[:to]).end_of_day
end
else
from = Time.now.beginning_of_day
to = Time.now.end_of_day
from = Time.current.beginning_of_day
to = Time.current.end_of_day
end
return from, to
end