UNPKG

@technobuddha/library

Version:
21 lines (20 loc) 777 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBeginningOfYear = void 0; var constants_1 = require("../constants"); /** * Determine the start of the year for a date * * @param input The date * @param __namedParameters see {@link Options} * @default UTC false * @returns The date value for midnight on the first day of the specified year */ function getBeginningOfYear(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(), constants_1.month.january, 1)); return new Date(input.getFullYear(), constants_1.month.january, 1); } exports.getBeginningOfYear = getBeginningOfYear; exports.default = getBeginningOfYear;