@technobuddha/library
Version:
A large library of useful functions
20 lines (19 loc) • 769 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBeginningOfMonth = void 0;
/**
* Determine the start of the month for a dateDetermine the start of the month for a date
*
* @param input The date
* @param __namedParamaters see {@link Options}
* @default UTC false
* @returns The date value for midnight on the first day of the specified month
*/
function getBeginningOfMonth(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(), 1));
return new Date(input.getFullYear(), input.getMonth(), 1);
}
exports.getBeginningOfMonth = getBeginningOfMonth;
exports.default = getBeginningOfMonth;