https://github.com/knutkirkhorn/week-number
📅 Get the ISO 8601 week number of a date
https://github.com/knutkirkhorn/week-number
api javascript nodejs number week week-number
Last synced: 7 months ago
JSON representation
📅 Get the ISO 8601 week number of a date
- Host: GitHub
- URL: https://github.com/knutkirkhorn/week-number
- Owner: knutkirkhorn
- License: mit
- Created: 2019-09-05T17:45:34.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T18:36:08.000Z (over 2 years ago)
- Last Synced: 2025-01-29T22:32:44.744Z (9 months ago)
- Topics: api, javascript, nodejs, number, week, week-number
- Language: JavaScript
- Size: 78.1 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# week-number
> 📅 Get the [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date) week number of a date
## Installation
```sh
npm install @knutkirkhorn/week-number
```## Usage
```js
import weekNumber, {yesterdayWeekNumber, tomorrowWeekNumber} from '@knutkirkhorn/week-number';console.log(weekNumber());
// => 36console.log(weekNumber(new Date()));
// => 36console.log(weekNumber('September 3, 2019 13:33:37'));
// => 36console.log(yesterdayWeekNumber());
// => 36console.log(tomorrowWeekNumber());
// => 36
```## API
### weekNumber([date])
Returns the [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date) week number of a date. If not date is passed, the current date is used.
### yesterdayWeekNumber()
Returns the [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date) week number of yesterday.
### tomorrowWeekNumber()
Returns the [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date) week number of tomorrow.
## Related
- [week-number-cli](https://github.com/knutkirkhorn/week-number-cli) - CLI for this module