fix #6: PT288H00M00S is a valid duration

This commit is contained in:
chfw 2017-04-07 08:21:32 +01:00
parent a632925dc2
commit 684f7101b9
2 changed files with 12 additions and 3 deletions

View File

@ -41,9 +41,11 @@ def ods_date_value(value):
def time_value(value):
"""convert to time value accroding the specification"""
hour = int(value[2:4])
minute = int(value[5:7])
second = int(value[8:10])
import re
results = re.match('PT(\d+)H(\d+)M(\d+)S', value)
hour = int(results.group(1))
minute = int(results.group(2))
second = int(results.group(3))
if hour < 24:
ret = datetime.time(hour, minute, second)
else:

View File

@ -84,3 +84,10 @@ def test_issue_14():
data = get_data(os.path.join("tests", "fixtures", test_file),
skip_empty_rows=True)
eq_(data['S-LMC'], [[u'aaa'], [0]])
def test_issue_6():
test_file = "12_day_as_time.ods"
data = get_data(os.path.join("tests", "fixtures", test_file),
skip_empty_rows=True)
eq_(data['Sheet1'][0][0].days, 12)