time-to-botec/js/node_modules/@stdlib/time/days-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

daysInYear

Determine the number of days in a year according to the Gregorian calendar.

Usage

var daysInYear = require( '@stdlib/time/days-in-year' );

daysInYear( [value] )

Returns the number of days in a year according to the Gregorian calendar.

var num = daysInYear();
// returns <number>

By default, the function returns the number of days in the current year (according to local time). To determine the number of days for a particular year, provide either a year or a Date object.

var num = daysInYear( new Date() );
// returns <number>

num = daysInYear( 2000 );
// returns 366

num = daysInYear( 2017 );
// returns 365

Notes

  • The function's return value is a generalization and does not take into account inaccuracies due to daylight savings conventions, crossing timezones, or other complications with time and dates.

Examples

var daysInYear = require( '@stdlib/time/days-in-year' );

var v;
var i;

for ( i = 0; i < 2021; i++ ) {
    v = daysInYear( i );
    console.log( 'The year %d has %d days.', i, v );
}

CLI

Usage

Usage: days-in-year [options] [year]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

$ days-in-year
<number>

For a specific year,

$ days-in-year 2016
366