getFirstDayOfWeek function takes a Date as an argument. Of course if a string is provided, the function will fail when it tries to getDay() on the string. Should I check if the date is an instanceof Date and return undefined if not? This can then be tested by providing something other than a Date. getFirstDayOfWeek function needs to suffer by expecting either a Date or undefined as a result of the function. Date isn't provided should I just use today's date and always return a Date.