Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1x 1x 11x 4x 4x 7x 7x | import { type DateOptions, month } from './date.ts'; /** * Determine the start of the year for a date * @param input - The date * @param options - see {@link DateOptions} * @defaultValue utc false * @returns The date value for midnight on the first day of the specified year * @group Time * @category Year */ export function beginningOfYear(input: Date, { utc = false }: DateOptions = {}): Date { if (utc) { return new Date(Date.UTC(input.getUTCFullYear(), month.january, 1)); } return new Date(input.getFullYear(), month.january, 1); } |