fix pyexcel issue #5

This commit is contained in:
chfw 2015-01-08 18:05:27 +00:00
parent cffc7cd733
commit 1d335cd138
3 changed files with 26 additions and 0 deletions

View File

@ -45,6 +45,15 @@ def xldate_to_python_date(value):
ret = datetime.date(date_tuple[0],
date_tuple[1],
date_tuple[2])
else:
ret = datetime.datetime(
date_tuple[0],
date_tuple[1],
date_tuple[2],
date_tuple[3],
date_tuple[4],
date_tuple[5]
)
return ret

Binary file not shown.

17
tests/test_bugfix.py Normal file
View File

@ -0,0 +1,17 @@
import os
import pyexcel as pe
import pyexcel.ext.xls
import datetime
class TestBugFix:
def test_pyexcel_issue_5(self):
"""pyexcel issue #5
datetime is not properly parsed
"""
s = pe.load(os.path.join("tests",
"test-fixtures",
"test-date-format.xls"))
assert s[0,0] == datetime.datetime(2015, 11, 11, 11, 12, 0)