From 65035ea315de696a408b76f9ea0bc5eead6d300f Mon Sep 17 00:00:00 2001 From: Nicolas Florentin Date: Wed, 14 Aug 2019 15:23:04 +0200 Subject: [PATCH] fix rake task fablab:maintenance:regenerate_invoices was not taking into account the timezone --- lib/tasks/fablab/maintenance.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/fablab/maintenance.rake b/lib/tasks/fablab/maintenance.rake index 3333c5efb..1d83138d3 100644 --- a/lib/tasks/fablab/maintenance.rake +++ b/lib/tasks/fablab/maintenance.rake @@ -5,9 +5,9 @@ namespace :fablab do namespace :maintenance do desc 'Regenerate the invoices PDF' task :regenerate_invoices, %i[year month] => :environment do |_task, args| - year = args.year || Time.now.year - month = args.month || Time.now.month - start_date = Time.new(year.to_i, month.to_i, 1) + year = args.year || Time.current.year + month = args.month || Time.current.month + start_date = Time.zone.local(year.to_i, month.to_i, 1) end_date = start_date.next_month puts "-> Start regenerate the invoices PDF between #{I18n.l start_date, format: :long} and " \ "#{I18n.l end_date - 1.minute, format: :long}"