@technobuddha/library
Version:
A large library of useful functions
24 lines (23 loc) • 1.01 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEndOfMonth = void 0;
var getDaysInMonth_1 = __importDefault(require("../getDaysInMonth"));
/**
* Determine the last day of the month containing the input date
*
* @param input The date
* @param __namedParameters see {@link Options}
* @default UTC false
* @returns Midnight on the last day of the month corresponding to the input date
*/
function getEndOfMonth(input, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.UTC, UTC = _c === void 0 ? false : _c;
if (UTC)
return new Date(Date.UTC(input.getUTCFullYear(), input.getUTCMonth(), getDaysInMonth_1.default(input, { UTC: UTC })));
return new Date(input.getFullYear(), input.getMonth(), getDaysInMonth_1.default(input, { UTC: UTC }));
}
exports.getEndOfMonth = getEndOfMonth;
exports.default = getEndOfMonth;