[Interval] inclusion partially works when check if a date is between two others date
See original GitHub issueDescribe the bug Coming from momentjs… When using luxon’s Interval class to check if date is between two others, I get unexpected behavior.
To Reproduce
Here is code:
Actual vs Expected behavior Actually test (2021-01-01) return correctly “true” Second test(2021-06-30) return “false” while I expect “true”
Desktop (please complete the following information):
- OS: windows
- Browser Version 96.0.4664.110 (Build officiel) (64 bits)
- Luxon version ^2.2.0
- Your timezone fr
Additional context
Start of 2.13.0 momentjs introduced inclusivity. I could do what i need with inlusivity = '[]'
Am i using it wrongly ? Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Determine Whether Two Date Ranges Overlap - Stack Overflow
(If one range is neither completely after the other, nor completely before the other, then they must overlap.) Now one of De Morgan's...
Read more >Does a date (or interval) fall within an interval? - lubridate
Check whether a lies within the interval b, inclusive of the endpoints.
Read more >Check IF a Date is Between Two Given Dates in Excel (Easy ...
Data analysis in Excel often involves working with dates. ... In this tutorial, I will show you how to check if the date...
Read more >Excel DATE function with formula examples to calculate dates
The tutorial explains the syntax and uses of the Excel DATE function and provides formula examples for calculating dates.
Read more >Test if two date ranges overlap in Ruby or Rails - makandra dev
The code below shows how to implement this in Ruby on Rails. The example is a class Interval , which has two attributes...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Luxon intervals are half-open, so like inclusivity=[). There is currently no way to change that, besides adding a millisecond to the end
@elvisbegovic Most applications want half-open intervals. If I want to represent “today”, then I mean from 00:00:00.000 through 23:59:59.999. But I don’t want to say that. I want to say “00:00:00 today to 00:00:00”. E.g.:
So we do that that half-open. This is the standard default for time intervals across most of the libraries I’ve used. If you want to include the endtime, do what @RemWisteria is doing.
It would require that every method in Interval check that parameter