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

isWithinInterval function breaks with start date < 2001/09/08 #3623

Closed
spennine opened this issue Dec 20, 2023 · 2 comments
Closed

isWithinInterval function breaks with start date < 2001/09/08 #3623

spennine opened this issue Dec 20, 2023 · 2 comments

Comments

@spennine
Copy link

spennine commented Dec 20, 2023

There is an issue with the isWithinInterval function

The problem

Interval.start date of 2001/09/09 or earlier, incorrectly reports false when testing a date that should be considered as 'within' the specified interval
image
a start date of 2001/09/10 or later correctly returns true
image

### 💻 Code demonstrating the problem

using the sandbox above, enter a start date on or before 2001/09/09 and any other valid dates that should return 'true' for the interval check
IE:
start = 2023/12/10
dateToTest = 2023/12/15
end = 2023/12/20

🙁 Actual behavior

function returns false when Interval.start is <= 2001/09/09, regardless of the test date and Interval.end date

🙂 Expected behavior

function returns true when the test date falls within the start/end Interval, inclusive

Debug information

  • date-fns version: >=V3.0.0
  • Browser/Node.js version: Chrome Version 120.0.6099.109 (Official Build) (arm64)
  • Your timezone: Eastern Standard Time (UTC -5)
  • Your current time: Eastern Standard Time (UTC -5)Wednesday 10:27:12 AMRhode Island, United States
kossnocorp added a commit that referenced this issue Dec 21, 2023
Fixed isWithinInterval bug caused by incorrectly sorting dates (#3623)
@kossnocorp
Copy link
Member

Thank you for reporting! Fixed in date-fns@3.0.4

@spennine
Copy link
Author

Thank you for reporting! Fixed in date-fns@3.0.4

ty for fixing :)

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

2 participants