1 | ;
|
2 | exports.isLastDayOfMonth = isLastDayOfMonth;
|
3 | var _index = require("./endOfDay.js");
|
4 | var _index2 = require("./endOfMonth.js");
|
5 | var _index3 = require("./toDate.js");
|
6 |
|
7 | /**
|
8 | * @name isLastDayOfMonth
|
9 | * @category Month Helpers
|
10 | * @summary Is the given date the last day of a month?
|
11 | *
|
12 | * @description
|
13 | * Is the given date the last day of a month?
|
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 | *
|
17 | * @param date - The date to check
|
18 |
|
19 | * @returns The date is the last day of a month
|
20 | *
|
21 | * @example
|
22 | * // Is 28 February 2014 the last day of a month?
|
23 | * const result = isLastDayOfMonth(new Date(2014, 1, 28))
|
24 | * //=> true
|
25 | */
|
26 | function isLastDayOfMonth(date) {
|
27 | const _date = (0, _index3.toDate)(date);
|
28 | return +(0, _index.endOfDay)(_date) === +(0, _index2.endOfMonth)(_date);
|
29 | }
|