Fix leak of the getDayOfWeek function into the global scope.
Check explicitly dow === 0.