lib/saxlsx/rows_collection_parser.rb in saxlsx-1.3.0 vs lib/saxlsx/rows_collection_parser.rb in saxlsx-1.3.1
- old
+ new
@@ -1,8 +1,8 @@
module Saxlsx
class RowsCollectionParser < Ox::Sax
- SECONDS_IN_DAY = BigDecimal.new(86400)
+ SECONDS_IN_DAY = 86400
NUM_FORMATS = {
0 => :string, # General
1 => :fixnum, # 0
2 => :float, # 0.00
3 => :fixnum, # #,##0
@@ -104,10 +104,10 @@
case @current_number_format
when :date
@base_date + text.to_i
when :date_time
# Round time to seconds
- date = @base_date + (BigDecimal.new(text) * SECONDS_IN_DAY).round / SECONDS_IN_DAY
+ date = @base_date + Rational((text.to_f * SECONDS_IN_DAY).round, SECONDS_IN_DAY)
DateTime.new(date.year, date.month, date.day, date.hour, date.minute, date.second)
when :fixnum
text.to_i
when :float
text.to_f
\ No newline at end of file