diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c7d3aa1..2a66091ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog Fab-manager - Updated ffi to 1.15.1 +- Updated GitHub issue templates +- Fix a bug: fablab:fix_invoices task fails to recreate the data if the date is in english ## v4.7.10 2021 May 25 diff --git a/lib/tasks/fablab/fix_invoices.rake b/lib/tasks/fablab/fix_invoices.rake index 20e2119ab..74747a2da 100644 --- a/lib/tasks/fablab/fix_invoices.rake +++ b/lib/tasks/fablab/fix_invoices.rake @@ -98,8 +98,9 @@ namespace :fablab do description = ii.description # DateTime.parse only works with english dates, so translate the month name month_idx = I18n.t('date.month_names').find_index { |month| month && description.include?(month) } - description.gsub!(/#{I18n.t('date.month_names')[month_idx]}/, I18n.t('date.month_names', locale: :en)[month_idx]) - + unless month_idx.nil? + description.gsub!(/#{I18n.t('date.month_names')[month_idx]}/, I18n.t('date.month_names', locale: :en)[month_idx]) + end start = DateTime.parse(description) end_time = DateTime.parse(/- (.+)$/.match(description)[1]) [start, DateTime.new(start.year, start.month, start.day, end_time.hour, end_time.min, end_time.sec, DateTime.current.zone)]