* When is the previous day of the week? 0-6 the day of the week, 0 represents Sunday.
9
*
10
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
11
*
12
* @param date - The date to check
13
* @param day - The day of the week
14
*
15
* @returns The date is the previous day of week
16
*
17
* @example
18
* // When is the previous Monday before Mar, 20, 2020?
19
* const result = previousDay(new Date(2020, 2, 20), 1)
20
* //=> Mon Mar 16 2020 00:00:00
21
*
22
* @example
23
* // When is the previous Tuesday before Mar, 21, 2020?
24
* const result = previousDay(new Date(2020, 2, 21), 2)