'Week' designators should not be combinable with year, month, day, hour, minute, or second

Issue #2 resolved
Brandon Nielsen repo owner created an issue

The ISO 8601 spec for durations allows for:

P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W

Currently we support W in combination with any of the other designators. This should not be the case.

Comments (1)

  1. Brandon Nielsen reporter

    Fixed in 1.2.0.

    >>> aniso8601.parse_duration('P1YT3M4W')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/nielsenb/Jetfuse/aniso8601_test/lib/python2.7/site-packages/aniso8601/duration.py", line 29, in parse_duration
        return _parse_duration_prescribed(isodurationstr, relative)
      File "/home/nielsenb/Jetfuse/aniso8601_test/lib/python2.7/site-packages/aniso8601/duration.py", line 59, in _parse_duration_prescribed
        raise ValueError('ISO 8601 week designators may not be combined with other time designators.')
    ValueError: ISO 8601 week designators may not be combined with other time designators.
    
  2. Log in to comment