1 import type { WeekStartsOn } from './interface';
4 weekStartsOn: WeekStartsOn;
6 const endfWeek = (date: Date, options?: Options) => {
7 const weekStartsOn = !options || typeof options.weekStartsOn === 'undefined' ? 0 : options.weekStartsOn;
9 const result = new Date(+date);
10 const day = result.getUTCDay();
11 const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
13 result.setUTCDate(date.getUTCDate() + diff);
14 result.setUTCHours(23, 59, 59, 999);
18 export default endfWeek;