Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joeybaker/day-of-week
Returns an number 0-6 of the day of the week from a date. Is timezone aware.
https://github.com/joeybaker/day-of-week
Last synced: 6 days ago
JSON representation
Returns an number 0-6 of the day of the week from a date. Is timezone aware.
- Host: GitHub
- URL: https://github.com/joeybaker/day-of-week
- Owner: joeybaker
- License: other
- Created: 2015-01-20T22:46:17.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-28T17:20:46.000Z (almost 10 years ago)
- Last Synced: 2024-12-26T17:08:06.907Z (20 days ago)
- Language: Shell
- Homepage:
- Size: 172 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image]
Returns an number 0-6 of the day of the week from a date. Is timezone aware.
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
- [Install](#install)
- [Usage](#usage)
- [Methods](#methods)
- [get `( date[, sourceTimezone[, destinationTimezone]])`](#get-date-date-string-sourcetimezone-string-destinationtimezone)
- [Arguments](#arguments)
- [Tests](#tests)
- [Developing](#developing)
- [Requirements](#requirements)
- [License](#license)## Install
```sh
npm i -S day-of-week
```## Usage
```js
var dayOfWeek = require('day-of-week').getdayOfWeek(new Date(2015, 1, 1), 'America/Los_Angeles')
// 4
```## Methods
### get `( date[, sourceTimezone[, 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](https://github.com/azer/prova), based on [tape](https://github.com/substack/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](https://byjoeybaker.com)
[npm-url]: https://npmjs.org/package/day-of-week
[npm-image]: https://badge.fury.io/js/day-of-week.svg
[travis-url]: https://travis-ci.org/joeybaker/day-of-week
[travis-image]: https://travis-ci.org/joeybaker/day-of-week.svg?branch=master
[daviddm-url]: https://david-dm.org/joeybaker/day-of-week.svg?theme=shields.io
[daviddm-image]: https://david-dm.org/joeybaker/day-of-week