From 5da13d60508f0ebacb3ba5afd3d29eb00c7ca59e Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Wed, 29 Oct 2014 01:28:52 +0900 Subject: Skip to_time if the value is a Time instance This skips calling `#to_time` if the value is a instance of subclass of `Time`, like `ActiveSupport::TimeWithZone`. --- lib/axlsx/workbook/worksheet/cell.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index cd9e1829..3136d0e0 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -452,7 +452,11 @@ module Axlsx v when :time self.style = STYLE_DATE if self.style == 0 - v.respond_to?(:to_time) ? v.to_time : v + if !v.is_a?(Time) && v.respond_to?(:to_time) + v.to_time + else + v + end when :float v.to_f when :integer -- cgit v1.2.3