Skip to content
New issue

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

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

Already on GitHub? # to your account

Create apoc.temporal.overlap(start1, end1, start2, end2, acceptAdjacentSpans:true) function #1464

Open
InverseFalcon opened this issue Mar 30, 2020 · 1 comment

Comments

@InverseFalcon
Copy link
Collaborator

InverseFalcon commented Mar 30, 2020

Feature description (Mandatory)
This function should take two timespans, broken into start and end temporal values for each (and an optional boolean for whether an adjacent timespans are considered overlapping, true by default), and returns a boolean on whether the two timespans overlap.

The general formula for calculating overlap is:

max(start1, start2) <= min(end1, end2)
If acceptAdjacentSpans:false, then this uses < instead.

This overlap formula is proved in this Stack Overflow answer:
https://stackoverflow.com/a/325964

This function acts as a shorthand, as this formula is likely not commonly known.

Considered alternatives

None considered at this time.

How this feature can improve the project?

Determining time range overlap is a common use case, and we don't currently have anything native or in APOC to deal with this.

@InverseFalcon InverseFalcon self-assigned this Mar 30, 2020
@InverseFalcon InverseFalcon changed the title Create apoc.temporal.overlap(start1, end1, start2, end2, acceptAdjacentSpans) function Create apoc.temporal.overlap(start1, end1, start2, end2, acceptAdjacentSpans:true) function Mar 30, 2020
@jexp jexp moved this to Todo in APOC Extended Larus Sep 21, 2023
@vga91 vga91 moved this from Todo to In Progress in APOC Extended Larus Feb 13, 2024
@vga91 vga91 moved this from In Progress to Review in APOC Extended Larus Feb 21, 2024
vga91 added a commit that referenced this issue Mar 6, 2024
vga91 added a commit that referenced this issue Mar 14, 2024
vga91 added a commit that referenced this issue Apr 16, 2024
@jexp
Copy link
Member

jexp commented Sep 5, 2024

@InverseFalcon any feedback?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
Development

No branches or pull requests

5 participants