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

Fix 4-arg arity of overlaps? #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/cljs_time/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,7 @@ Specify the year, month, and day."
(overlaps? start-a end-a start-b end-b)))
([start-a end-a start-b end-b]
(or (and (before? start-b end-a) (after? end-b start-a))
(and (after? end-b start-a) (before? start-b end-a))
(or (= start-a end-b) (= start-b end-a)))))
(and (after? end-b start-a) (before? start-b end-a)))))

(defn overlap
"Returns an Interval representing the overlap of the specified Intervals.
Expand Down
6 changes: 4 additions & 2 deletions test/cljs_time/core_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,10 @@
(is (overlaps? ld1 ld5 ld1 ld5))
(is (overlaps? ld1 ld5 ld2 ld4))
(is (overlaps? ld2 ld4 ld1 ld5))
(is (overlaps? ld1 ld2 ld2 ld3))
(is (overlaps? ld2 ld3 ld1 ld2))
;; abut, do not overlap
(is (not (overlaps? ld1 ld2 ld2 ld3)))
;; abut, do not overlap
(is (not (overlaps? ld2 ld3 ld1 ld2)))
(is (not (overlaps? ld1 ld2 ld3 ld4)))
(is (not (overlaps? ld1 ld3 ld4 ld5)))))

Expand Down