isFirstDayOfMonth.cjs 725 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. exports.isFirstDayOfMonth = isFirstDayOfMonth;
  3. var _index = require("./toDate.cjs");
  4. /**
  5. * The {@link isFirstDayOfMonth} function options.
  6. */
  7. /**
  8. * @name isFirstDayOfMonth
  9. * @category Month Helpers
  10. * @summary Is the given date the first day of a month?
  11. *
  12. * @description
  13. * Is the given date the first day of a month?
  14. *
  15. * @param date - The date to check
  16. * @param options - An object with options
  17. *
  18. * @returns The date is the first day of a month
  19. *
  20. * @example
  21. * // Is 1 September 2014 the first day of a month?
  22. * const result = isFirstDayOfMonth(new Date(2014, 8, 1))
  23. * //=> true
  24. */
  25. function isFirstDayOfMonth(date, options) {
  26. return (0, _index.toDate)(date, options?.in).getDate() === 1;
  27. }