MCPcopy
hub / github.com/date-fns/date-fns / startOfYear

Function startOfYear

pkgs/core/src/startOfYear/index.ts:33–44  ·  view source on GitHub ↗
(
  date: DateArg<DateType>,
  options?: StartOfYearOptions<ResultDate> | undefined,
)

Source from the content-addressed store, hash-verified

31 * //=> Wed Jan 01 2014 00:00:00
32 */
33export function startOfYear<
34 DateType extends Date,
35 ResultDate extends Date = DateType,
36>(
37 date: DateArg<DateType>,
38 options?: StartOfYearOptions<ResultDate> | undefined,
39): ResultDate {
40 const date_ = toDate(date, options?.in);
41 date_.setFullYear(date_.getFullYear(), 0, 1);
42 date_.setHours(0, 0, 0, 0);
43 return date_;
44}

Callers 3

test.tsFile · 0.90
getDayOfYearFunction · 0.90
eachWeekendOfYearFunction · 0.90

Calls 1

toDateFunction · 0.90

Tested by

no test coverage detected