1 | import type { ContextOptions, DateArg } from "./types.js";
|
2 | /**
|
3 | * The {@link previousTuesday} function options.
|
4 | */
|
5 | export interface PreviousTuesdayOptions<DateType extends Date = Date>
|
6 | extends ContextOptions<DateType> {}
|
7 | /**
|
8 | * @name previousTuesday
|
9 | * @category Weekday Helpers
|
10 | * @summary When is the previous Tuesday?
|
11 | *
|
12 | * @description
|
13 | * When is the previous Tuesday?
|
14 | *
|
15 | * @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).
|
16 | * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
|
17 | *
|
18 | * @param date - The date to start counting from
|
19 | * @param options - An object with options
|
20 | *
|
21 | * @returns The previous Tuesday
|
22 | *
|
23 | * @example
|
24 | * // When is the previous Tuesday before Jun, 18, 2021?
|
25 | * const result = previousTuesday(new Date(2021, 5, 18))
|
26 | * //=> Tue June 15 2021 00:00:00
|
27 | */
|
28 | export declare function previousTuesday<
|
29 | DateType extends Date,
|
30 | ResultDate extends Date = DateType,
|
31 | >(
|
32 | date: DateArg<DateType>,
|
33 | options?: PreviousTuesdayOptions<ResultDate> | undefined,
|
34 | ): ResultDate;
|