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

Add additional range/interval operators #71

Open
erikc5000 opened this issue May 21, 2020 · 0 comments
Open

Add additional range/interval operators #71

erikc5000 opened this issue May 21, 2020 · 0 comments
Labels
design Design issue/question enhancement New feature or request

Comments

@erikc5000
Copy link
Owner

Some of the following operators could be quite useful additions:

  • range1 union range2
  • range1 intersect range2
  • range1 span range2
  • range1.abuts(range2)
  • range1.encloses(range2)
  • range1.overlaps(range2)
  • range.mapEndpoints(start = { it.startOfWeek }, endInclusive = { it.endOfWeek })
  • range.mapEndpoints { it.startOfWeek } - apply a function to both endpoints
  • range.shiftedBy((-1).days) - specialization of mapEndpoints that maps the start/end by a period or duration
  • range.copy(start = anotherDate)

ZonedDateTimeInterval and OffsetDateTimeInterval pose some challenges since the endpoints may have different zones or offsets. It might make sense to have them return InstantInterval if you try to perform a union or intersection on them, for example.

@erikc5000 erikc5000 added enhancement New feature or request design Design issue/question labels May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design issue/question enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant