Bugfix: when calculating the timestamp (for months and years), ignore the Timezone

Fixes GH-194
This commit is contained in:
Guillaume Boudreau 2024-09-22 07:32:33 -04:00
parent 2fd7c7bbf1
commit 644b7f489d

View file

@ -11,14 +11,14 @@ module ApplicationHelper
end
def year_timespan(year)
start_at = Time.utc(year).in_time_zone(Time.zone).beginning_of_year.strftime('%Y-%m-%dT%H:%M')
end_at = Time.utc(year).in_time_zone(Time.zone).end_of_year.strftime('%Y-%m-%dT%H:%M')
start_at = Time.new(year).beginning_of_year.strftime('%Y-%m-%dT%H:%M')
end_at = Time.new(year).end_of_year.strftime('%Y-%m-%dT%H:%M')
{ start_at:, end_at: }
end
def timespan(month, year)
month = DateTime.new(year, month).in_time_zone(Time.zone)
month = DateTime.new(year, month)
start_at = month.beginning_of_month.to_time.strftime('%Y-%m-%dT%H:%M')
end_at = month.end_of_month.to_time.strftime('%Y-%m-%dT%H:%M')