Skip to content

Commit

Permalink
feat: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jackypan1989 committed Oct 8, 2020
1 parent f654ec8 commit 79d0233
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,36 @@ Let your date libaray like [Moment.js](https://momentjs.com/) can count holidays
- [x] configurable holidays
- [x] configurable make-up days
- [x] support [Moment.js](https://momentjs.com/)
- [ ] support [Day.js](https://day.js.org/)
- [ ] support [date-fns](https://date-fns.org/)
- [x] support [Day.js](https://day.js.org/)
- [x] support [date-fns](https://date-fns.org/)
- [ ] fully tests

## install

```
```bash
# use npm
yarn add business-day
npm install business-day

# use npm
npm i business-day
```

## usage

```js
import moment from 'moment'
import BusinessDay from 'business-day'
import { MomentCore as BusinessDay } from 'business-day'

// 2020-12-01 (Tuesday), 2020-12-02 (Wednesday)

BusinessDay.setConfig({ holidays: ['2020-12-01'] })
const day1 = moment('2020-11-30')
console.log(BusinessDay.addBusinessDays(day1, 1))
console.log(BusinessDay.addBusinessDays(day1.toDate(), 1))
// Moment<2020-12-02T00:00:00+08:00>

BusinessDay.setConfig({ holidays: ['2020-12-01', '2020-12-02'] })
const day2 = moment('2020-11-30')
console.log(BusinessDay.addBusinessDays(day2, 1))
console.log(BusinessDay.addBusinessDays(day2.toDate(), 1))
// Moment<2020-12-03T00:00:00+08:00>

```

0 comments on commit 79d0233

Please sign in to comment.