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

Function endOfYesterday

pkgs/core/src/endOfYesterday/index.ts:31–40  ·  view source on GitHub ↗
(options?: EndOfYesterdayOptions<ResultDate> | undefined)

Source from the content-addressed store, hash-verified

29 * //=> Sun Oct 5 2014 23:59:59.999
30 */
31export function endOfYesterday<
32 DateType extends Date,
33 ResultDate extends Date = DateType,
34>(options?: EndOfYesterdayOptions<ResultDate> | undefined): ResultDate {
35 const now = constructNow(options?.in);
36 const date = constructFrom(options?.in, 0);
37 date.setFullYear(now.getFullYear(), now.getMonth(), now.getDate() - 1);
38 date.setHours(23, 59, 59, 999);
39 return date;
40}

Callers 1

test.tsFile · 0.90

Calls 2

constructNowFunction · 0.90
constructFromFunction · 0.90

Tested by

no test coverage detected