day-of-week

1.0.4 • Public • Published

NPM version Build Status Dependency Status

Returns an number 0-6 of the day of the week from a date. Is timezone aware.

Table of Contents generated with DocToc

Install

npm i -S day-of-week

Usage

var dayOfWeek = require('day-of-week').get
 
dayOfWeek(new Date(2015, 1, 1), 'America/Los_Angeles')
// 4

Methods

get (<Date> date[, <String> sourceTimezone[, <String> destinationTimezone]])

Returns the day of the week for the passed date. If a timezone is passed as the second argument, it will ensure that the date is interpreted in that timezone.

Arguments

  • date String or unixTime or Date required.
  • sourceTimezone String: the timezone that the date is in. Must be passed in Olson TZID timezone format. e.g. America/Los_Angeles
  • destinationTimezone String: if the source timezone is passed, the destination timezone will convert from the source timezone to the destination timezone before determining the day of the week.

Tests

Tests are prova, based on tape. They can be run with npm test.

Tests can be run in a loop with npm run tdd

Developing

To publish, run npm run release -- [{patch,minor,major}]

NOTE: you might need to sudo ln -s /usr/local/bin/node /usr/bin/node to ensure node is in your path for the git hooks to work

Requirements

  • npm > 2.0.0 So that passing args to a npm script will work. npm i -g npm
  • git > 1.8.3 So that git push --follow-tags will work. brew install git

License

Artistic 2.0 © Joey Baker

Package Sidebar

Install

npm i day-of-week

Weekly Downloads

2

Version

1.0.4

License

Artistic-2.0

Last publish

Collaborators

  • joeybaker