Skip to content

areIntervalsOverlapping returns false for overlapping interval #3614

@skbogner

Description

@skbogner

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

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

🙁 Actual behavior

areIntervalsOverlapping returns false

🙂 Expected behavior

areIntervalsOverlapping returns true

Debug information

  • date-fns version: 3.0.0
  • Browser/Node.js version: Multiple/Any
  • Your timezone: Europe/Copenhagen
  • Your current time: 10:00-11:00

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions