import requiredArgs from '../_lib/requiredArgs/index' ; import getDay from '../getDay/index' ; import subDays from '../subDays/index' ; import type { Day } from '../types' ; name category summary description param { Date | number } date param { number } day returns { Date } throws example example export default function previousDay ( date , day ) { requiredArgs ( 2 , arguments ) ; let delta = getDay ( date ) - day ; if ( delta <= 0 ) delta += 7 ; return subDays ( date , delta ) ; }