zdavatz / spreadsheet

The Ruby Spreadsheet by ywesee GmbH
http://spreadsheet.ch
GNU General Public License v3.0
1.13k stars 240 forks source link

Leap error in range 1/1/1900 - 28/1/1900 #194

Closed AlfonsoUceda closed 6 years ago

AlfonsoUceda commented 7 years ago

Hi:

In my company we are using this gem to read and generate XLS files and we've noticed that there is an error handling a range of dates between 1/1/1900 and 28/1/1900.

There is an example for more context:

book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet sheet1.name = 'My First Worksheet' sheet1[0,0] = DateTime.new(1900, 2, 28) book.write 'excel-file.xls'

You'll see 27/02/1900 in the excel file

- Reading
```ruby
require 'spreadsheet'

book = Spreadsheet.open 'excel-file.xls'
sheet1 = book.worksheet 0

sheet1.each do |row|
  puts row[0]
end

# You'll see 28/02/1900

Thank you for your time.

zdavatz commented 6 years ago

Thank you for reporting this. Let me know if you come up with a patch.

zdavatz commented 6 years ago

date

zdavatz commented 6 years ago

This is what I get when I open the file with LibreOffice 6.0.5.2.