week_no

get the week number for a date

npm install week_no
8 downloads in the last month

weekNo

Build Status

Calculate the week number for a given date

This module extends the Date.prototype, I know don't do this, whatever. If you need week numbers I think it's clean this way.

By default weeks are numberd based on 1970-1-5 (the first monday of 1970, as this presents the first week.

example

require('week_no');
new Date(1971, 0, 5).weekNo() # => 52
new Date(1972, 0, 5).weekNo() # => 104

methods

require('week_no')

new Date(1970, 0, 5).weekNo()

Return a the number of weeks since 1970-1-5.

new Date(1970, 0, 5).weekNoRelative()

Return a the number of weeks since 1970-1-5 modulo 52.

install

With npm do:

npm install week_no

license

BSD

npm loves you