9 lines
408 B
Plaintext
9 lines
408 B
Plaintext
"use strict";
|
|
const isAfter = require("./isAfter.js");
|
|
const isBefore = require("./isBefore.js");
|
|
function isBetween(date, from, to, unit, inclusivity) {
|
|
inclusivity = inclusivity || "()";
|
|
return (inclusivity.startsWith("(") ? isAfter(date, from, unit) : !isBefore(date, from, unit)) && (inclusivity.charAt(1) === ")" ? isBefore(date, to, unit) : !isAfter(date, to, unit));
|
|
}
|
|
module.exports = isBetween;
|