current-week-number

Get current week number of the current year,given Date format string or Date object.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
current-week-number
2231.0.78 years ago8 years agoMinified + gzip package size for current-week-number in KB

Readme

!npmnpmjs-imgnpmjs-url !mit licenselicense-imglicense-url !build statustravis-imgtravis-url !coverage statuscoveralls-imgcoveralls-url !deps statusdaviddm-imgdaviddm-url

Get current week number of the current year,given Date format string or Date object.

Install

npm i --save current-week-number
npm test
current-week-number --help

API

For more use-cases see the tests

currentWeekNumber

Get week number of the current date/year or given valid Date string format

  • [date] {String} every valid Date-ish string format
  • return {Number}

Example:
var currentWeekNumber = require('current-week-number');

// june 27, 2014
currentWeekNumber();
//=> 26

currentWeekNumber('March 24, 2015');
//=> 13

currentWeekNumber(new Date('March 24, 2015'));
//=> 13

currentWeekNumber('03/24/2016');
//=> 12, cuz' year is leap

currentWeekNumber('August 07, 2015');
//=> 32

currentWeekNumber(new Date('August 07, 2016'));
//=> 31

currentWeekNumber('02/16/2015');
//=> 8

currentWeekNumber('September 15, 2126');
//=> 37

currentWeekNumber('02/17/2012');
//=> 7

CLI

You can just run current-week-number --help for more information

Author

Charlike Mike Reagent

License !MIT licenselicense-imglicense-url

Copyright (c) 2014-2015 Charlike Mike Reagentcontrib-more, contributorscontrib-graf.
Released under the MITlicense-url license.

Powered and automated by kdf
, March 02, 2015