UNPKG

@technobuddha/library

Version:
20 lines (19 loc) 726 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBeginningOfDay = void 0; /** * Determine the start of the day for a date * * @param input The date * @param __namedParameters see {@link Options} * @default UTC false * @returns The date value for midnight on the specified day */ function getBeginningOfDay(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(), input.getUTCDate())); return new Date(input.getFullYear(), input.getMonth(), input.getDate()); } exports.getBeginningOfDay = getBeginningOfDay; exports.default = getBeginningOfDay;