Skip to content

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

@MetRonnie

Description

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

is a bug Something is wrong :( 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)

Metadata

Metadata

Assignees

Labels

bugSomething is wrong :(

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions