-
Notifications
You must be signed in to change notification settings - Fork 110
Local date range #189
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
Local date range #189
Conversation
range and progression semantics with the LocalDate and DatePeriod classes.
We have a similar request, but for |
@dkhalanskyjb I've had a use case for this, though it's more of a convenience having a dedicated A few other use cases off the top of my head:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Could you also make the range an implementation of
Collection
? See https://youtrack.jetbrains.com/issue/KT-36932/Let-Progression-classes-implement-Collection-to-reduce-time-when-iterates-over-IntRange-when-cast-to-Iterable - All API entries (classes, functions, properties) need separate tests, a KDoc, and a usage sample.
Something I came across that's not exactly an issue in the library, but is a usability question when using the library in IntelliJ that I'm wondering if there's a good answer for. Because Kotlin automatically imports (localDate1..localDate2).forEach {
// some code in here
}
This is easily solved by importing |
@PeterAttardo, maybe this issue can be solved if |
@dkhalanskyjb I was hoping not to have to touch the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compilation fails for me, and when I fix it, the getSize
test fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the small naming issue, I think it's good to go!
…ession.contains()
…d of IllegalArgumentException
Thank you a lot for the hard work! Merged manually in d15ec21 to squash this into one commit. |
I noticed that |
@lukellmann, thanks, added the fix to the |
This pull request enables Kotlin range and progression semantics with the LocalDate and DatePeriod classes. Its implementation borrows from the patterns used for
IntRange
.Example: