UNPKG

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