1 | import type { ContextOptions, DateArg } from "./types.js";
|
2 | /**
|
3 | * The {@link differenceInBusinessDays} function options.
|
4 | */
|
5 | export interface DifferenceInBusinessDaysOptions extends ContextOptions<Date> {}
|
6 | /**
|
7 | * @name differenceInBusinessDays
|
8 | * @category Day Helpers
|
9 | * @summary Get the number of business days between the given dates.
|
10 | *
|
11 | * @description
|
12 | * Get the number of business day periods between the given dates.
|
13 | * Business days being days that aren't in the weekend.
|
14 | * Like `differenceInCalendarDays`, the function removes the times from
|
15 | * the dates before calculating the difference.
|
16 | *
|
17 | * @param laterDate - The later date
|
18 | * @param earlierDate - The earlier date
|
19 | * @param options - An object with options
|
20 | *
|
21 | * @returns The number of business days
|
22 | *
|
23 | * @example
|
24 | * // How many business days are between
|
25 | * // 10 January 2014 and 20 July 2014?
|
26 | * const result = differenceInBusinessDays(
|
27 | * new Date(2014, 6, 20),
|
28 | * new Date(2014, 0, 10)
|
29 | * )
|
30 | * //=> 136
|
31 | *
|
32 | * // How many business days are between
|
33 | * // 30 November 2021 and 1 November 2021?
|
34 | * const result = differenceInBusinessDays(
|
35 | * new Date(2021, 10, 30),
|
36 | * new Date(2021, 10, 1)
|
37 | * )
|
38 | * //=> 21
|
39 | *
|
40 | * // How many business days are between
|
41 | * // 1 November 2021 and 1 December 2021?
|
42 | * const result = differenceInBusinessDays(
|
43 | * new Date(2021, 10, 1),
|
44 | * new Date(2021, 11, 1)
|
45 | * )
|
46 | * //=> -22
|
47 | *
|
48 | * // How many business days are between
|
49 | * // 1 November 2021 and 1 November 2021 ?
|
50 | * const result = differenceInBusinessDays(
|
51 | * new Date(2021, 10, 1),
|
52 | * new Date(2021, 10, 1)
|
53 | * )
|
54 | * //=> 0
|
55 | */
|
56 | export declare function differenceInBusinessDays(
|
57 | laterDate: DateArg<Date> & {},
|
58 | earlierDate: DateArg<Date> & {},
|
59 | options?: DifferenceInBusinessDaysOptions | undefined,
|
60 | ): number;
|