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

FR: int_overlaps with exclusive endpoints #1153

Open
ismirsehregal opened this issue Jan 24, 2024 · 0 comments
Open

FR: int_overlaps with exclusive endpoints #1153

ismirsehregal opened this issue Jan 24, 2024 · 0 comments

Comments

@ismirsehregal
Copy link

ismirsehregal commented Jan 24, 2024

It would be great for int_overlaps to gain a exclusive parameter (for both - start and endpoint).
Currently, via int_overlaps I can't properly test if a timestamp greater than 23:59:59 but smaller 00:00:00 of the next day belongs to a certain day.

# this includes endpoints greater than 23:59:59:
int_overlaps(interval(today(), today() + days(1)), interval(ymd_hms(paste(today(), "23:59:59.3")), today() + days(1)))

# but it also includes 00:00:00 of the next day:
int_overlaps(interval(today(), today() + days(1)), interval(today() + days(1), today() + days(2)))

# we can avoid this by removing one second from the first interval:
int_overlaps(interval(today(), today() + days(1) - seconds(1)), interval(today() + days(1), today() + days(2)))

# but this excludes endpoints greater than 23:59:59:
int_overlaps(interval(today(), today() + days(1) - seconds(1)), interval(ymd_hms(paste(today(), "23:59:59.3")), today() + days(1)))

For now I'm using format(my_timestamp, digits = 0L) / floor_date as a workaround.

Same question came up here:
#805
and here:
https://stackoverflow.com/questions/27280338/exclusive-time-intervals-in-rs-lubridate

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