Mac base date is not used correctly
Created originally on Bitbucket by bjwebb (Ben Webb)
Openpyxl reads the property from the workbook, and correctly propagates this information to the base_date
attribute on a cell. However, the actual value
attribute is wrong.
>>> import openpyxl
>>> wb = openpyxl.load_workbook('/home/bjwebb/Downloads/GGIS_Grant_Awards_2016_to_2017_2017-10-27_1621.xlsx')
/home/bjwebb/opendataservices/cove/.ve/lib/python3.5/site-packages/openpyxl/reader/worksheet.py:318: UserWarning: Unknown extension is not supported and will be removed
warn(msg)
>>> wb.excel_base_date
2416480.5
>>> from openpyxl.utils.datetime import CALENDAR_MAC_1904
>>> CALENDAR_MAC_1904
2416480.5
>>> from openpyxl.utils.datetime import CALENDAR_WINDOWS_1900
>>> CALENDAR_WINDOWS_1900
2415018.5
>>> wb['GGIS_Grant_Awards_2016_to_2017 ']['F2'].value
datetime.datetime(2012, 10, 2, 0, 0)
>>> # We expected datetime.datetime(2016, 10, 3, 0, 0)
>>> wb['GGIS_Grant_Awards_2016_to_2017 ']['F2'].base_date
2416480.5
>>> wb['GGIS_Grant_Awards_2016_to_2017 ']['F2'].base_date is CALENDAR_MAC_1904
True
I notice that the from_excel method appears to do what I want, but this is called without an offset in openpyxl.reader.worksheet, and is commented out in openpyxl.cell.cell.