UNPKG

893 BJavaScriptView Raw
1"use strict";
2exports.isThisQuarter = isThisQuarter;
3var _index = require("./constructNow.js");
4var _index2 = require("./isSameQuarter.js");
5
6/**
7 * @name isThisQuarter
8 * @category Quarter Helpers
9 * @summary Is the given date in the same quarter as the current date?
10 * @pure false
11 *
12 * @description
13 * Is the given date in the same quarter as the current date?
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 in this quarter
20 *
21 * @example
22 * // If today is 25 September 2014, is 2 July 2014 in this quarter?
23 * const result = isThisQuarter(new Date(2014, 6, 2))
24 * //=> true
25 */
26function isThisQuarter(date) {
27 return (0, _index2.isSameQuarter)(date, (0, _index.constructNow)(date));
28}