1 | import type { ContextOptions, DateArg } from "./types.js";
|
2 | /**
|
3 | * The {@link startOfMonth} function options.
|
4 | */
|
5 | export interface StartOfMonthOptions<ResultDate extends Date>
|
6 | extends ContextOptions<ResultDate> {}
|
7 | /**
|
8 | * @name startOfMonth
|
9 | * @category Month Helpers
|
10 | * @summary Return the start of a month for the given date.
|
11 | *
|
12 | * @description
|
13 | * Return the start of a month for the given date. The result will be in the local timezone.
|
14 | *
|
15 | * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments.
|
16 | * Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
17 | * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed,
|
18 | * or inferred from the arguments.
|
19 | *
|
20 | * @param date - The original date
|
21 | * @param options - An object with options
|
22 | *
|
23 | * @returns The start of a month
|
24 | *
|
25 | * @example
|
26 | * // The start of a month for 2 September 2014 11:55:00:
|
27 | * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
|
28 | * //=> Mon Sep 01 2014 00:00:00
|
29 | */
|
30 | export declare function startOfMonth<
|
31 | DateType extends Date,
|
32 | ResultDate extends Date = DateType,
|
33 | >(
|
34 | date: DateArg<DateType>,
|
35 | options?: StartOfMonthOptions<ResultDate> | undefined,
|
36 | ): ResultDate;
|