index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = isThisMonth;
  7. var _index = _interopRequireDefault(require("../isSameMonth/index.js"));
  8. var _index2 = _interopRequireDefault(require("../_lib/requiredArgs/index.js"));
  9. /**
  10. * @name isThisMonth
  11. * @category Month Helpers
  12. * @summary Is the given date in the same month as the current date?
  13. * @pure false
  14. *
  15. * @description
  16. * Is the given date in the same month as the current date?
  17. *
  18. * > ⚠️ Please note that this function is not present in the FP submodule as
  19. * > it uses `Date.now()` internally hence impure and can't be safely curried.
  20. *
  21. * @param {Date|Number} date - the date to check
  22. * @returns {Boolean} the date is in this month
  23. * @throws {TypeError} 1 argument required
  24. *
  25. * @example
  26. * // If today is 25 September 2014, is 15 September 2014 in this month?
  27. * const result = isThisMonth(new Date(2014, 8, 15))
  28. * //=> true
  29. */
  30. function isThisMonth(dirtyDate) {
  31. (0, _index2.default)(1, arguments);
  32. return (0, _index.default)(Date.now(), dirtyDate);
  33. }
  34. module.exports = exports.default;