This is an example of calculating the day of the week from a numerical date.
Implementing Zeller's Congruence using JavaScript
Zeller used decimal arithmetic
"J" and "K" are calculated using the standard year which introduces some additional modifications such as treating January and February as months 13 and 14 of the previous year. "-2J" is converted to "+5J" to avoid negative numbers and is simply advancing the days by 7 which still results in the same day of the week and avoids taking the modulus of a negative number which bothers JavaScript but which Zeller appears not to have minded.