date-fns#isMonday TypeScript Examples

The following examples show how to use date-fns#isMonday. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: dategrid.ts    From calendar-hack with MIT License 6 votes vote down vote up
selectAll(dow: dayOfWeek) {
        if (!this.first || !this.last) return []
        const dates = eachDayOfInterval({ start: this.first, end: this.last });
        switch (dow) {
            case 'Monday':
                return dates.filter(d => isMonday(d));
            case 'Tuesday':
                return dates.filter(d => isTuesday(d));
            case 'Wednesday':
                return dates.filter(d => isWednesday(d));
            case 'Thursday':
                return dates.filter(d => isThursday(d));
            case 'Friday':
                return dates.filter(d => isFriday(d));
            case 'Saturday':
                return dates.filter(d => isSaturday(d));
            case 'Sunday':
                return dates.filter(d => isSunday(d));
            default:
                throw new Error(`unhandled day of week ${dow}`);
        }
    }