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

Function startOfYesterday

pkgs/core/src/startOfYesterday/index.ts:31–43  ·  view source on GitHub ↗
(
  options?: StartOfYesterdayOptions<ContextDate> | undefined,
)

Source from the content-addressed store, hash-verified

29 * //=> Sun Oct 5 2014 00:00:00
30 */
31export function startOfYesterday<ContextDate extends Date>(
32 options?: StartOfYesterdayOptions<ContextDate> | undefined,
33): ContextDate {
34 const now = constructNow(options?.in);
35 const year = now.getFullYear();
36 const month = now.getMonth();
37 const day = now.getDate();
38
39 const date = constructNow(options?.in);
40 date.setFullYear(year, month, day - 1);
41 date.setHours(0, 0, 0, 0);
42 return date;
43}

Callers 1

test.tsFile · 0.90

Calls 1

constructNowFunction · 0.90

Tested by

no test coverage detected