Simple function to get the current month's week number for a given day in that month.
The main reason I created this package was as a result of wanting to do something that I thought was easy but after spending hours without getting it right and a lot of suggested solutions on stack overflow not achieving what I wanted. I vowed that once I get it working I'll publish the solution for someone to use it if they ever have similar requirement that I had. So this is me fulfilling my vow :); I hope someone will find this useful. Thanks to Cornelous and Tinashe for their valuable input.
npm install current-month-week-number --save
var weekNumber = require('current-month-week-number'); var weekNumberIs = weekNumber.weekNumberOfCurrentMonth(11); // 11th of the current month var weekNumberForGivenDate = weekNumber.weekNumberForGivenDate('2017', '1', '17');// i.e January 17th 2017 Note: month must be between 1-12 and date between 1-31 and year must be full year including century like 2010 or 1999
npm install npm test npm run coverage