Merged r2250 and r2251 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2252 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-01-10 10:51:59 +00:00
parent 3155b8ccad
commit 764393aa6a
5 changed files with 26 additions and 4 deletions
+3 -1
View File
@@ -24,7 +24,9 @@ module Redmine #:nodoc:
def to_hours
s = self.dup
s.strip!
unless s =~ %r{^[\d\.,]+$}
if s =~ %r{^(\d+([.,]\d+)?)h?$}
s = $1
else
# 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