isThisMonth.js 877 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. exports.isThisMonth = isThisMonth;
  3. var _index = require("./constructNow.js");
  4. var _index2 = require("./isSameMonth.js");
  5. /**
  6. * @name isThisMonth
  7. * @category Month Helpers
  8. * @summary Is the given date in the same month as the current date?
  9. * @pure false
  10. *
  11. * @description
  12. * Is the given date in the same month as the current date?
  13. *
  14. * @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).
  15. *
  16. * @param date - The date to check
  17. *
  18. * @returns The date is in this month
  19. *
  20. * @example
  21. * // If today is 25 September 2014, is 15 September 2014 in this month?
  22. * const result = isThisMonth(new Date(2014, 8, 15))
  23. * //=> true
  24. */
  25. function isThisMonth(date) {
  26. return (0, _index2.isSameMonth)(date, (0, _index.constructNow)(date));
  27. }