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

Overlaps adjacent option not working #213

Closed
lom200 opened this issue Jan 19, 2018 · 1 comment
Closed

Overlaps adjacent option not working #213

lom200 opened this issue Jan 19, 2018 · 1 comment
Labels

Comments

@lom200
Copy link

lom200 commented Jan 19, 2018

var a = moment("2018-02-01T03:00:00")
var b = moment("2018-02-01T13:00:00")
var range1 = moment.range(a, b);
var range2 = moment.range(b, b);
range1.overlaps(range2) // true
range1.overlaps(range2, {adjacent: false}) // true

As I see in your code the intersect function does not honor the adjacent flag.
The intersect const is not null but a range made up of the end of the first range.

overlaps(other, options = { adjacent: false }) {
    const intersect = (this.intersect(other) !== null);

    if (options.adjacent && !intersect) {
      return this.adjacent(other);
    }

    return intersect;
  }
@gf3
Copy link
Contributor

gf3 commented Jan 19, 2018

thanks for the bug report @lom200! i have a PR for the fix here: #215

we'll try to get it released as quick as possible

@gf3 gf3 added the bug label Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants