import { firstWeekDay } from "https://deno.land/x/complaindate@v1.0.1/mod.ts";
Get a function curried with a weekday to jump to from its plain-date arguments.
The curried function will return the given date if matching the target weekday.
Examples
Example 1
Example 1
// Seeking the first Monday backwards from `date`
const addOneDay = addDays(1);
const subOneWeek = addDays(-7);
const firstMonday = firstWeekDay(WeekDay.MONDAY);
subOneWeek(firstMonday(addOneDay(date)));
Parameters
targetWeekDay: WeekDayNumber
ISO weekday number (1-7) starting with Monday
Returns
<T extends ComPlainDate>(date: T) => T
A curried function that operates on plain-dates