awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
364 stars 79 forks source link

convertToDate off by 1 for dates between 1900-01-01 and 1900-02-28 #469

Open Eddolan opened 5 years ago

Eddolan commented 5 years ago

Expected Behavior

In an excel workbook the number "10" when converted to a date will yield 1900-01-10.

Actual Behavior

convertToDate(c(10)) // "1900-01-09"

Steps to Reproduce the Problem

(please attach an example xlsx file if possible)

test.xlsx convertToDate(c(10)) // "1900-01-09"

The reason to this has to do with the leap year bug where excel incorrectly assumes 1900-02-29 to be a real date, when in actuality it is not.

Any fix for this should consider the behavior of converting the number 60, which excel converts to 1900-02-29, which is not a real date.