-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
index.js
28 lines (27 loc) · 1.07 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import getISOYear from '../getISOYear/index.js'
/**
* @name differenceInCalendarISOYears
* @category ISO Week-Numbering Year Helpers
* @summary Get the number of calendar ISO week-numbering years between the given dates.
*
* @description
* Get the number of calendar ISO week-numbering years between the given dates.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} dateLeft - the earlier date
* @param {Date|String|Number} dateRight - the later date
* @param {Options} [options] - the object with options. See [Options]{@link docs/Options}
* @returns {Number} the number of calendar ISO week-numbering years
*
* @example
* // How many calendar ISO week-numbering years are 1 January 2010 and 1 January 2012?
* var result = differenceInCalendarISOYears(
* new Date(2010, 0, 1),
* new Date(2012, 0, 1)
* )
* //=> 2
*/
export default function differenceInCalendarISOYears (dirtyDateLeft, dirtyDateRight, dirtyOptions) {
return getISOYear(dirtyDateRight, dirtyOptions) - getISOYear(dirtyDateLeft, dirtyOptions)
}