UNPKG

1.07 kBTypeScriptView Raw
1import type {
2 ContextOptions,
3 DateArg,
4 LocalizedOptions,
5 WeekOptions,
6} from "./types.js";
7/**
8 * The {@link isThisWeek} function options.
9 */
10export interface IsThisWeekOptions
11 extends WeekOptions,
12 LocalizedOptions<"options">,
13 ContextOptions<Date> {}
14/**
15 * @name isThisWeek
16 * @category Week Helpers
17 * @summary Is the given date in the same week as the current date?
18 * @pure false
19 *
20 * @description
21 * Is the given date in the same week as the current date?
22 *
23 * @param date - The date to check
24 * @param options - The object with options
25 *
26 * @returns The date is in this week
27 *
28 * @example
29 * // If today is 25 September 2014, is 21 September 2014 in this week?
30 * const result = isThisWeek(new Date(2014, 8, 21))
31 * //=> true
32 *
33 * @example
34 * // If today is 25 September 2014 and week starts with Monday
35 * // is 21 September 2014 in this week?
36 * const result = isThisWeek(new Date(2014, 8, 21), { weekStartsOn: 1 })
37 * //=> false
38 */
39export declare function isThisWeek(
40 date: DateArg<Date> & {},
41 options?: IsThisWeekOptions,
42): boolean;