`next()` can return a datetime that is in the past
>>> now = 2020-10-19T13:53Z >>> next(--10-19) 2020-10-19T00:00Z
is a https://github.com/cylc/cylc-flow/labels/bug because it returns a datetime that is in the past!
It should be
2021-10-19T00:00Z # next year
Similarly (but less severe), previous() goes back too far
>>> previous(--10-19)
2019-10-19T00:00Z
when it should be
2020-10-19T00:00Z
because just as
T00is short forT0000and01is short for01T0000,--10-19is short for--10-19T0000.I.E. matching date-time components should not be a special case.
Note this is somewhat of a breaking change, so tagged against next minor version rather than maintenance version.
Originally posted by @MetRonnie in https://github.com/cylc/cylc-flow/issues/5777#issuecomment-1772521629
We may fix this in https://github.com/metomi/isodatetime/pull/234
To close this issue, these tests should be fixed:
https://github.com/cylc/cylc-flow/blob/238ce2890c4ccb2ecc576a5c79902fb2e8a22cba/tests/unit/cycling/test_iso8601.py#L688
https://github.com/cylc/cylc-flow/blob/238ce2890c4ccb2ecc576a5c79902fb2e8a22cba/tests/unit/cycling/test_iso8601.py#L712
@MetRonnie - bumping this back to 8.4 for now as it seems to have stagnated for a bit.
:+1: The fix is ready but has not been a priority for review