14 lines
391 B
Plaintext
14 lines
391 B
Plaintext
"use strict";
|
|
const normalizeUnit = require("./normalizeUnit-Cn0hUyBC.js");
|
|
const endOf = require("./endOf.js");
|
|
const parse = require("./parse.js");
|
|
function isBefore(date, input, unit) {
|
|
unit = normalizeUnit.normalizeUnit(unit);
|
|
const inputMs = +parse(input);
|
|
if (!unit) {
|
|
return +date < inputMs;
|
|
}
|
|
return +endOf(new Date(date), unit) < inputMs;
|
|
}
|
|
module.exports = isBefore;
|