We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
areIntervalsOverlapping
There is an issue with the areIntervalsOverlapping function
https://stackblitz.com/edit/date-fns-playground-c8oyu9?file=index.ts
import { areIntervalsOverlapping } from 'date-fns'; const left = { start: '1970-01-01T02:00:00.000Z', end: '1970-01-01T03:00:00.000Z', }; const right = { start: '1969-12-31T23:30:00.000Z', end: '1970-01-01T02:30:00.000Z', }; console.log(areIntervalsOverlapping(left, right, { inclusive: true })); // => false
areIntervalsOverlapping returns false
false
areIntervalsOverlapping returns true
true
The text was updated successfully, but these errors were encountered:
For additional context, seems related to crossing 1970:
areIntervalsOverlapping( {start: new Date('2024-01-01T02:00:00.000Z'), end: new Date('2024-01-01T03:00:00.000Z')}, {start: new Date('2023-12-31T23:30:00.000Z'), end: new Date('2024-01-01T02:30:00.000Z')} ) // true areIntervalsOverlapping( {start: new Date('1970-01-01T02:00:00.000Z'), end: new Date('1970-01-01T03:00:00.000Z')}, {start: new Date('1969-12-31T23:30:00.000Z'), end: new Date('1970-01-01T02:30:00.000Z')} ) // false (true in v2) areIntervalsOverlapping( {start: new Date('1971-01-01T02:00:00.000Z'), end: new Date('1971-01-01T03:00:00.000Z')}, {start: new Date('1970-12-31T23:30:00.000Z'), end: new Date('1971-01-01T02:30:00.000Z')} ) // true
Sorry, something went wrong.
9ac551c
Fixed and shipped with date-fns@3.0.6
date-fns@3.0.6
No branches or pull requests
There is an issue with the areIntervalsOverlapping function
The problem
馃捇 Code demonstrating the problem
https://stackblitz.com/edit/date-fns-playground-c8oyu9?file=index.ts
馃檨 Actual behavior
areIntervalsOverlapping
returnsfalse
馃檪 Expected behavior
areIntervalsOverlapping
returnstrue
Debug information
The text was updated successfully, but these errors were encountered: