UNPKG

760 BJavaScriptView Raw
1"use strict";
2exports.previousFriday = previousFriday;
3var _index = require("./previousDay.js");
4
5/**
6 * @name previousFriday
7 * @category Weekday Helpers
8 * @summary When is the previous Friday?
9 *
10 * @description
11 * When is the previous Friday?
12 *
13 * @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).
14 *
15 * @param date - The date to start counting from
16 *
17 * @returns The previous Friday
18 *
19 * @example
20 * // When is the previous Friday before Jun, 19, 2021?
21 * const result = previousFriday(new Date(2021, 5, 19))
22 * //=> Fri June 18 2021 00:00:00
23 */
24function previousFriday(date) {
25 return (0, _index.previousDay)(date, 5);
26}