vsf-utilities
Version:
Utilities functions shared between vsf projects
21 lines • 623 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function isSpecialPriceActive(fromDate, toDate) {
if (!fromDate && !toDate) {
return true;
}
const now = new Date();
fromDate = fromDate ? new Date(fromDate) : false;
toDate = toDate ? new Date(toDate) : false;
if (fromDate && toDate) {
return fromDate < now && toDate > now;
}
if (fromDate && !toDate) {
return fromDate < now;
}
if (!fromDate && toDate) {
return toDate > now;
}
}
exports.default = isSpecialPriceActive;
//# sourceMappingURL=isSpecialPriceActive.js.map