UNPKG

750 BJavaScriptView Raw
1import { constructNow } from "./constructNow.js";
2import { isSameMinute } from "./isSameMinute.js";
3
4/**
5 * @name isThisMinute
6 * @category Minute Helpers
7 * @summary Is the given date in the same minute as the current date?
8 * @pure false
9 *
10 * @description
11 * Is the given date in the same minute as the current date?
12 *
13 * @param date - The date to check
14 *
15 * @returns The date is in this minute
16 *
17 * @example
18 * // If now is 25 September 2014 18:30:15.500,
19 * // is 25 September 2014 18:30:00 in this minute?
20 * const result = isThisMinute(new Date(2014, 8, 25, 18, 30))
21 * //=> true
22 */
23
24export function isThisMinute(date) {
25 return isSameMinute(date, constructNow(date));
26}
27
28// Fallback for modularized imports:
29export default isThisMinute;