This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns the week number for this date. | |
* https://stackoverflow.com/questions/9045868/javascript-date-getweek | |
* @param {Date} date | |
* @param {number} [dowOffset] — The day of week the week "starts" on for your locale - it can be from `0` to `6`. By default `dowOffset` is `0` (USA, Sunday). If `dowOffset` is 1 (Monday), the week returned is the ISO 8601 week number. | |
* @return {number} | |
*/ | |
export default function getWeek(date, dowOffset = 0) { | |
/*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */ | |
const newYear = new Date(date.getFullYear(), 0, 1); |