Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next() can return a datetime that is in the past #5795

Open
MetRonnie opened this issue Oct 27, 2023 · 4 comments · May be fixed by #5928
Open

next() can return a datetime that is in the past #5795

MetRonnie opened this issue Oct 27, 2023 · 4 comments · May be fixed by #5928
Assignees
Labels
Milestone

Comments

@MetRonnie
Copy link
Member

MetRonnie commented Oct 27, 2023

>>> now = 2020-10-19T13:53Z
>>> next(--10-19)
2020-10-19T00:00Z

is a 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 T00 is short for T0000 and 01 is short for 01T0000, --10-19 is 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 #5777 (comment)

@MetRonnie MetRonnie added the bug label Oct 27, 2023
@MetRonnie MetRonnie added this to the cylc-8.3.0 milestone Oct 27, 2023
@MetRonnie MetRonnie self-assigned this Oct 27, 2023
@MetRonnie
Copy link
Member Author

We may fix this in metomi/isodatetime#234

@oliver-sanders
Copy link
Member

To close this issue, these tests should be fixed:

param('next(--08-08)', '20110808T0000Z', marks=pytest.mark.xfail),

param('previous(--08-08)', '20100808T0000Z', marks=pytest.mark.xfail),

@MetRonnie MetRonnie linked a pull request Jan 16, 2024 that will close this issue
10 tasks
@hjoliver
Copy link
Member

@MetRonnie - bumping this back to 8.4 for now as it seems to have stagnated for a bit.

@hjoliver hjoliver modified the milestones: cylc-8.3.0, cylc-8.4.0 Mar 14, 2024
@MetRonnie
Copy link
Member Author

👍 The fix is ready but has not been a priority for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants