Commits

Matthew Schinckel committed 6b30444

Don't require seconds, when input is in the format 00:00

Comments (0)

Files changed (1)

timedelta/helpers.py

     """
     # This is the format we sometimes get from Postgres.
     d = re.match(r'((?P<days>\d+) days )?(?P<hours>\d+):'
-                 r'(?P<minutes>\d+):(?P<seconds>\d+)',
+                 r'(?P<minutes>\d+)(:(?P<seconds>\d+))?',
                  str(string))
     if d: 
         d = d.groupdict(0)
     floats/Decimals
     """
     assert isinstance(obj1, datetime.timedelta), "First argument must be a timedelta."
-    assert isinstance(obj2, (datetime.timedelta, int, float, Decimal)), "Second argument must be a timedelta or number"
+    #assert isinstance(obj2, (datetime.timedelta, int, float, Decimal)), "Second argument must be a timedelta or number"
     
     sec1 = obj1.days * 86400 + obj1.seconds
     if isinstance(obj2, datetime.timedelta):