summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-02-23 11:48:08 +0900
committerRandy Morgan <[email protected]>2012-02-23 11:48:08 +0900
commitd9705fa234819fd640e2e5fdb5422a8d22d8ff3b (patch)
tree95c62346ef7c69d941b0d450d0cec8107c9e2418 /lib
parentbde6f651d0a7c0f9661c881bbb1a5e44f3e83c9f (diff)
downloadcaxlsx-d9705fa234819fd640e2e5fdb5422a8d22d8ff3b.tar.gz
caxlsx-d9705fa234819fd640e2e5fdb5422a8d22d8ff3b.zip
out of time to play with this. We will need to create some 1.8.7 valid test later.
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.