summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJurriaan Pruis <[email protected]>2012-03-02 10:19:31 +0100
committerJurriaan Pruis <[email protected]>2012-03-02 10:19:31 +0100
commit223d4baee0f9aeb3485321d6f4128eb34e0dfce3 (patch)
treee6f33877ad41e4877af5386ccbb2e93bc721f6ce
parentb169cc9d067fb8c195d452768ef4d70414bc25c1 (diff)
downloadcaxlsx-223d4baee0f9aeb3485321d6f4128eb34e0dfce3.tar.gz
caxlsx-223d4baee0f9aeb3485321d6f4128eb34e0dfce3.zip
Default to 1900 date system
Office 2011 for Mac uses the 1900 system by default see http://www.officeformachelp.com/2010/10/excel-2011-defaults-to-1900-date-system/ for more info
-rw-r--r--lib/axlsx/workbook/workbook.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb
index b3b10fac..cbb85349 100644
--- a/lib/axlsx/workbook/workbook.rb
+++ b/lib/axlsx/workbook/workbook.rb
@@ -99,25 +99,17 @@ require 'axlsx/workbook/shared_strings_table.rb'
# Creates a new Workbook
# The recomended way to work with workbooks is via Package#workbook
- # @option options [Boolean] date1904. If this is not specified, we try to determine if the platform is bsd/darwin and set date1904 to true automatically.
+ # @option options [Boolean] date1904. If this is not specified, date1904 is set to false. Office 2011 for Mac defaults to false.
def initialize(options={})
@styles = Styles.new
@worksheets = SimpleTypedList.new Worksheet
@drawings = SimpleTypedList.new Drawing
@charts = SimpleTypedList.new Chart
@images = SimpleTypedList.new Pic
- self.date1904= options[:date1904].nil? ? is_bsd? : options[:date1904]
+ self.date1904= !options[:date1904].nil? && options[:date1904]
yield self if block_given?
end
- # Uses RUBY_PLATFORM constant to determine if the OS is freebsd or darwin
- # based on this value we attempt to set date1904.
- # @return [Boolean]
- def is_bsd?
- platform = RUBY_PLATFORM.downcase
- platform.include?('freebsd') || platform.include?('darwin')
- end
-
# Instance level access to the class variable 1904
# @return [Boolean]
def date1904() @@date1904; end