diff options
Diffstat (limited to 'lib/redmine')
-rw-r--r-- | lib/redmine/core_ext/string/conversions.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/redmine/core_ext/string/conversions.rb b/lib/redmine/core_ext/string/conversions.rb index c52b334e4..d125448bd 100644 --- a/lib/redmine/core_ext/string/conversions.rb +++ b/lib/redmine/core_ext/string/conversions.rb @@ -33,9 +33,9 @@ module Redmine s = $1 else # 2:30 => 2.5 - s.gsub!(%r{^(\d+):(\d+)$}) { $1.to_i + $2.to_i / 60.0 } + s.gsub!(%r{^(\d+):(\d+)$}) {$1.to_i + $2.to_i / 60.0} # 2h30, 2h, 30m => 2.5, 2, 0.5 - s.gsub!(%r{^((\d+)\s*(h|hours?))?\s*((\d+)\s*(m|min)?)?$}i) { |m| ($1 || $4) ? ($2.to_i + $5.to_i / 60.0) : m[0] } + s.gsub!(%r{^((\d+)\s*(h|hours?))?\s*((\d+)\s*(m|min)?)?$}i) {|m| ($1 || $4) ? ($2.to_i + $5.to_i / 60.0) : m[0]} end # 2,5 => 2.5 s.tr!(',', '.') |