getMinutes.js 647 B

123456789101112131415161718192021222324252627282930
  1. import { toDate } from "./toDate.js";
  2. /**
  3. * The {@link getMinutes} function options.
  4. */
  5. /**
  6. * @name getMinutes
  7. * @category Minute Helpers
  8. * @summary Get the minutes of the given date.
  9. *
  10. * @description
  11. * Get the minutes of the given date.
  12. *
  13. * @param date - The given date
  14. * @param options - The options
  15. *
  16. * @returns The minutes
  17. *
  18. * @example
  19. * // Get the minutes of 29 February 2012 11:45:05:
  20. * const result = getMinutes(new Date(2012, 1, 29, 11, 45, 5))
  21. * //=> 45
  22. */
  23. export function getMinutes(date, options) {
  24. return toDate(date, options?.in).getMinutes();
  25. }
  26. // Fallback for modularized imports:
  27. export default getMinutes;