summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/workbook/worksheet/date_time_converter.rb8
1 files changed, 6 insertions, 2 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.