time-to-botec/js/node_modules/@stdlib/time/iso-weeks-in-year/README.md
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

2.6 KiB

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