UNPKG

1.35 kBMarkdownView Raw
1# moment-weekofmonth
2[![moment-weekofmonth-CI](https://github.com/swtpumpkin/moment-weekofmonth/workflows/moment-weekofmonth-CI/badge.svg?branch=master)](https://github.com/swtpumpkin/moment-weekofmonth/actions)
3[![version](https://img.shields.io/npm/v/moment-weekofmonth.svg?style=flat-square)]((http://npm.im/moment-weekofmonth))
4[![install size](https://packagephobia.now.sh/badge?p=moment-weekofmonth)](https://packagephobia.now.sh/result?p=moment-weekofmonth)
5[![downloads](https://img.shields.io/npm/dm/moment-weekofmonth.svg?style=flat-square)](https://npm-stat.com/charts.html?package=moment-weekofmonth&from=2020-03-05)
6
7Gets the week of the month.
8Use the moment object to find the week number of the month.
9
10## Installation
11Install via NPM:
12
13```bash
14npm install moment moment-weekofmonth
15```
16
17## Usage
18
19#### Javascript
20```javascript
21var moment = require("moment");
22var wom = require("moment-weekofmonth");
23var nowDate = moment(); // 2020-02-29
24
25wom(moment('2020-01-01')); // 1
26wom(nowDate); // 5
27wom(); // TypeError: Cannot read property 'week' of undefined
28```
29
30#### TypeScript
31```typescript
32import * as moment from "moment";
33import * as wom from "moment-weekofmonth";
34
35const nowDate = moment(); // 2020-02-29
36
37wom(moment('2020-01-01')); // 1
38wom(nowDate); // 5
39wom(); // TypeError: Cannot read property 'week' of undefined```
40```