mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-17 11:54:22 +01:00
[bug] fablab:fix_invoices date parsing error
This commit is contained in:
parent
266982b24a
commit
4e601b672a
@ -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
|
||||
|
||||
|
@ -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)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user