17 lines
706 B
JavaScript
17 lines
706 B
JavaScript
"use strict";
|
|||
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
|
exports.computeCashInvoiceExpiry = computeCashInvoiceExpiry;
|
||
|
|
function computeCashInvoiceExpiry(company) {
|
||
|
|
const now = new Date();
|
||
|
|
if (company.cashInvoiceValidUntilHour != null &&
|
||
|
|
Number.isFinite(company.cashInvoiceValidUntilHour)) {
|
||
|
|
const expires = new Date(now);
|
||
|
|
expires.setHours(company.cashInvoiceValidUntilHour, 0, 0, 0);
|
||
|
|
if (expires.getTime() <= now.getTime()) {
|
||
|
|
expires.setDate(expires.getDate() + 1);
|
||
|
|
}
|
||
|
|
return expires;
|
||
|
|
}
|
||
|
|
return new Date(now.getTime() + company.cashInvoiceValidityHours * 60 * 60 * 1000);
|
||
|
|
}
|
||
|
|
//# sourceMappingURL=cash-expiry.js.map
|