UNPKG

1.34 kBTypeScriptView Raw
1import type {
2 ContextOptions,
3 DateArg,
4 LocalizedOptions,
5 WeekOptions,
6} from "./types.js";
7/**
8 * The {@link differenceInCalendarWeeks} function options.
9 */
10export interface DifferenceInCalendarWeeksOptions
11 extends LocalizedOptions<"options">,
12 WeekOptions,
13 ContextOptions<Date> {}
14/**
15 * @name differenceInCalendarWeeks
16 * @category Week Helpers
17 * @summary Get the number of calendar weeks between the given dates.
18 *
19 * @description
20 * Get the number of calendar weeks between the given dates.
21 *
22 * @param laterDate - The later date
23 * @param earlierDate - The earlier date
24 * @param options - An object with options.
25 *
26 * @returns The number of calendar weeks
27 *
28 * @example
29 * // How many calendar weeks are between 5 July 2014 and 20 July 2014?
30 * const result = differenceInCalendarWeeks(
31 * new Date(2014, 6, 20),
32 * new Date(2014, 6, 5)
33 * )
34 * //=> 3
35 *
36 * @example
37 * // If the week starts on Monday,
38 * // how many calendar weeks are between 5 July 2014 and 20 July 2014?
39 * const result = differenceInCalendarWeeks(
40 * new Date(2014, 6, 20),
41 * new Date(2014, 6, 5),
42 * { weekStartsOn: 1 }
43 * )
44 * //=> 2
45 */
46export declare function differenceInCalendarWeeks(
47 laterDate: DateArg<Date> & {},
48 earlierDate: DateArg<Date> & {},
49 options?: DifferenceInCalendarWeeksOptions | undefined,
50): number;