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

until should always return an Interval #1551

Open
ab-pm opened this issue Dec 6, 2023 · 0 comments
Open

until should always return an Interval #1551

ab-pm opened this issue Dec 6, 2023 · 0 comments

Comments

@ab-pm
Copy link

ab-pm commented Dec 6, 2023

When .until(…) is called on an invalid Datetime instance, it returns the instance itself instead of an invalid Interval.

To Reproduce

Interval.isInterval(DateTime.now().until(DateTime.invalid('demo'))) // true (ok)
Interval.isInterval(DateTime.invalid('demo').until(DateTime.now())) // false!
DateTime.isDateTime(DateTime.invalid('demo').until(DateTime.now())) // true!

It seems the bug was introduced in a2602aa#diff-5146f40a8c8111b14e5ab3407eff80c7a6d2f3c92a4bf4ccd4647bff32d47e38R1317-R1319 (although even back then, it did sometimes return an interval and sometimes a Duration.invalid()). In diff() and .diffNow() this has been subsequently fixed during a reimplementation, but until still exhibits the unexpected behaviour.

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

No branches or pull requests

1 participant