29 lines
826 B
JavaScript
29 lines
826 B
JavaScript
var isSameWeek = require('../is_same_week/index.js')
|
|
|
|
/**
|
|
* @category ISO Week Helpers
|
|
* @summary Are the given dates in the same ISO week?
|
|
*
|
|
* @description
|
|
* Are the given dates in the same ISO week?
|
|
*
|
|
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
*
|
|
* @param {Date|String|Number} dateLeft - the first date to check
|
|
* @param {Date|String|Number} dateRight - the second date to check
|
|
* @returns {Boolean} the dates are in the same ISO week
|
|
*
|
|
* @example
|
|
* // Are 1 September 2014 and 7 September 2014 in the same ISO week?
|
|
* var result = isSameISOWeek(
|
|
* new Date(2014, 8, 1),
|
|
* new Date(2014, 8, 7)
|
|
* )
|
|
* //=> true
|
|
*/
|
|
function isSameISOWeek (dirtyDateLeft, dirtyDateRight) {
|
|
return isSameWeek(dirtyDateLeft, dirtyDateRight, {weekStartsOn: 1})
|
|
}
|
|
|
|
module.exports = isSameISOWeek
|