- half = int(m.groups()[0])
- century = roman_to_int(str(m.groups()[1]))
- t = ((century*100 + (half-1)*50), 1, 1)
+ half = m.group(1)
+ decade = m.group(3)
+ century = roman_to_int(str(m.group(2)))
+ if half is not None:
+ if decade is not None:
+ raise ValueError("Bad date format. Cannot specify both half and decade of century")
+ half = int(half)
+ t = ((century*100 + (half-1)*50), 1, 1)
+ else:
+ decade = int(decade or 0)
+ t = ((century*100 + decade), 1, 1)
+ elif m2:
+ year = int(m2.group(1))
+ t = (year, 1, 1)