Skip to content

Instantly share code, notes, and snippets.

@pignuante
Created June 5, 2020 00:51
Show Gist options
  • Save pignuante/b9c1574dbcf513e0f04958f72b3102bb to your computer and use it in GitHub Desktop.
Save pignuante/b9c1574dbcf513e0f04958f72b3102bb to your computer and use it in GitHub Desktop.
function getWeekOfMonth(date) {
let adjustedDate = date.getDate()+date.getDay();
let prefixes = ['0', '1', '2', '3', '4', '5'];
return (parseInt(prefixes[0 | adjustedDate / 7])+1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment