Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

previousDay

import { previousDay } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// When is the previous Monday before Mar, 20, 2020?
const result = previousDay(new Date(2020, 2, 20), 1)
//=> Mon Mar 16 2020 00:00:00
@example
// When is the previous Tuesday before Mar, 21, 2020?
const result = previousDay(new Date(2020, 2, 21), 2)
//=> Tue Mar 17 2020 00:00:00
function previousDay<DateType extends Date>(date: DateType | number | string, day: Day): DateType;
§
previousDay<DateType extends Date>(date: DateType | number | string, day: Day): DateType
[src]

§Type Parameters

§
DateType extends Date
[src]

§Parameters

§
date: DateType | number | string
[src]
  • The date to check
§
  • The day of the week

§Return Type

§
DateType
[src]

The date is the previous day of week