|
||
---|---|---|
.. | ||
bin | ||
docs | ||
etc | ||
lib | ||
package.json | ||
README.md |
isoWeeksInYear
Determine the number of ISO weeks in a year according to the Gregorian calendar.
Usage
var isoWeeksInYear = require( '@stdlib/time/iso-weeks-in-year' );
isoWeeksInYear( [value] )
Returns the number of ISO weeks in a year according to the Gregorian calendar.
var num = isoWeeksInYear();
// returns <number>
By default, the function returns the number of ISO weeks in the current year (according to local time). To determine the number of ISO weeks for a particular year, provide either a year or a Date
object.
var num = isoWeeksInYear( new Date() );
// returns <number>
num = isoWeeksInYear( 2015 );
// returns 53
num = isoWeeksInYear( 2017 );
// returns 52
Examples
var isoWeeksInYear = require( '@stdlib/time/iso-weeks-in-year' );
var v;
var i;
for ( i = 0; i < 2021; i++ ) {
v = isoWeeksInYear( i );
console.log( 'The year %d has %d ISO weeks.', i, v );
}
CLI
Usage
Usage: iso-weeks-in-year [options] [year]
Options:
-h, --help Print this message.
-V, --version Print the package version.
Examples
$ iso-weeks-in-year
<number>
For a specific year,
$ iso-weeks-in-year 2015
53