UNPKG

617 BJavaScriptView Raw
1import { toDate } from "./toDate.js";
2
3/**
4 * The {@link isMonday} function options.
5 */
6
7/**
8 * @name isMonday
9 * @category Weekday Helpers
10 * @summary Is the given date Monday?
11 *
12 * @description
13 * Is the given date Monday?
14 *
15 * @param date - The date to check
16 * @param options - An object with options
17 *
18 * @returns The date is Monday
19 *
20 * @example
21 * // Is 22 September 2014 Monday?
22 * const result = isMonday(new Date(2014, 8, 22))
23 * //=> true
24 */
25export function isMonday(date, options) {
26 return toDate(date, options?.in).getDay() === 1;
27}
28
29// Fallback for modularized imports:
30export default isMonday;