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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user