From d9705fa234819fd640e2e5fdb5422a8d22d8ff3b Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Thu, 23 Feb 2012 11:48:08 +0900 Subject: out of time to play with this. We will need to create some 1.8.7 valid test later. --- lib/axlsx/workbook/worksheet/date_time_converter.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') 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. -- cgit v1.2.3