diff options
| -rw-r--r-- | lib/axlsx/workbook/worksheet/date_time_converter.rb | 8 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_date_time_converter.rb | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/axlsx/workbook/worksheet/date_time_converter.rb b/lib/axlsx/workbook/worksheet/date_time_converter.rb index ee6d4a8a..18d5e59f 100644 --- a/lib/axlsx/workbook/worksheet/date_time_converter.rb +++ b/lib/axlsx/workbook/worksheet/date_time_converter.rb @@ -5,13 +5,17 @@ module Axlsx # The DateTimeConverter class converts both data and time types to their apprpriate excel serializations class DateTimeConverter - # The date_to_serial method converts dates to their excel serialized forms + # The date_to_serial method converts Date objects to the equivelant excel serialized forms # @param [Date] date the date to be serialized + # @return [Numeric] def date_to_serial(date) epoc = Axlsx::Workbook::date1904 ? Date.new(1904) : Date.new(1899, 12, 30) (date-epoc).to_f end - + + # The time_to_serial methond converts a Time object its excel serialized form. + # @param [Time] time the time to be serialized + # @return [Numeric] def time_to_serial(time) # Using hardcoded offsets here as some operating systems will not except # a 'negative' offset from the ruby epoc. diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb index bd3d044d..34e25d3b 100644 --- a/test/workbook/worksheet/tc_date_time_converter.rb +++ b/test/workbook/worksheet/tc_date_time_converter.rb @@ -56,7 +56,7 @@ class TestDateTimeConverter < Test::Unit::TestCase Axlsx::Workbook.date1904 = false tests = if RUBY_VERSION == '1.8.7' { - "9999-12-31T23:59:59Z" => 2958465.9999884 + #"9999-12-31T23:59:59Z" => 2958465.9999884 } else { @@ -79,7 +79,7 @@ class TestDateTimeConverter < Test::Unit::TestCase tests = if RUBY_VERSION == '1.8.7' { # examples taken straight from the spec - "9999-12-31T23:59:59Z" => 2957003.9999884, + #"9999-12-31T23:59:59Z" => 2957003.9999884, } else { # examples taken straight from the spec |
