aboutsummaryrefslogtreecommitdiffstats
path: root/lib/roo/excelx/cell
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-03-19 21:48:07 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2022-03-19 21:48:07 -0400
commita6e765da9b4da8cf9ddedcbaeb29fe5dca5df263 (patch)
tree39a2e5d06c16d048e9618e1170e3b6304fbade2e /lib/roo/excelx/cell
parente67f4551479264125a641b955523d95e192b6d44 (diff)
parentf5fb17e5a64b215644bc104f099dad8c2f10c37d (diff)
Update upstream source from tag 'upstream/2.9.0'
Update to upstream version '2.9.0' with Debian dir 41b8f9c552bbf25b076de11901d6f615d684366f
Diffstat (limited to 'lib/roo/excelx/cell')
-rw-r--r--lib/roo/excelx/cell/number.rb3
-rw-r--r--lib/roo/excelx/cell/time.rb2
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/roo/excelx/cell/number.rb b/lib/roo/excelx/cell/number.rb
index 9f23c4f..7ea48b5 100644
--- a/lib/roo/excelx/cell/number.rb
+++ b/lib/roo/excelx/cell/number.rb
@@ -48,7 +48,7 @@ module Roo
when /^(0+)$/ then "%0#{$1.size}d"
when /^0\.(0+)$/ then "%.#{$1.size}f"
when '#,##0' then number_format('%.0f')
- when '#,##0.00' then number_format('%.2f')
+ when /^#,##0.(0+)$/ then number_format("%.#{$1.size}f")
when '0%'
proc do |number|
Kernel.format('%d%%', number.to_f * 100)
@@ -64,6 +64,7 @@ module Roo
when '#,##0.00;[Red](#,##0.00)' then number_format('%.2f', '[Red](%.2f)')
# FIXME: not quite sure what the format should look like in this case.
when '##0.0E+0' then '%.1E'
+ when "_-* #,##0.00\\ _€_-;\\-* #,##0.00\\ _€_-;_-* \"-\"??\\ _€_-;_-@_-" then number_format('%.2f', '-%.2f')
when '@' then proc { |number| number }
else
raise "Unknown format: #{format.inspect}"
diff --git a/lib/roo/excelx/cell/time.rb b/lib/roo/excelx/cell/time.rb
index a1f0864..5fed1e2 100644
--- a/lib/roo/excelx/cell/time.rb
+++ b/lib/roo/excelx/cell/time.rb
@@ -13,7 +13,7 @@ module Roo
super
@format = excelx_type.last
@datetime = create_datetime(base_date, value)
- @value = link ? Roo::Link.new(link, value) : (value.to_f * 86_400).to_i
+ @value = link ? Roo::Link.new(link, value) : (value.to_f * 86_400).round.to_i
end
def formatted_value