Skip to content

Instantly share code, notes, and snippets.

@mattpuchlerz
Created January 15, 2010 20:12
Show Gist options
  • Save mattpuchlerz/278376 to your computer and use it in GitHub Desktop.
Save mattpuchlerz/278376 to your computer and use it in GitHub Desktop.
Date.prototype.beginningOfWeek = function (startOfWeek) {
startOfWeek = startOfWeek || 0;
return new Date( this - ( (this.getDay() - startOfWeek) * 86400000) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment