Commits

Anonymous committed 4bf8cd6

Makes time syntax case insensitive (#10635).

  • Participants
  • Parent commits 2771640

Comments (0)

Files changed (2)

File lib/redmine/core_ext/string/conversions.rb

             # 2:30 => 2.5
             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)?)?$}) { |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.gsub!(',', '.')

File test/unit/time_entry_test.rb

                    "3 h 15 m" => 3.25,
                    "3 hours"  => 3.0,
                    "12min"    => 0.2,
+                   "12 Min"    => 0.2,
                   }
 
     assertions.each do |k, v|