-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(readme): update readme template
- Loading branch information
1 parent
2f4e21b
commit a57346f
Showing
4 changed files
with
163 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
## 🌩 Installation | ||
|
||
``` | ||
npm install --save is-office-hours | ||
``` | ||
|
||
## 🕹 Usage | ||
|
||
### isOfficeHours | ||
|
||
Returns `true` if the provided `Date` falls within Monday to Friday 9:00am to | ||
4:59pm. | ||
|
||
```js | ||
import { isOfficeHours } from 'is-office-hours'; | ||
|
||
isOfficeHours(new Date('2019-03-04T08:59:59.000Z')); | ||
// false | ||
isOfficeHours(new Date('2019-03-04T09:00:00.000Z')); | ||
// true | ||
isOfficeHours(new Date('2019-03-04T09:01:00.000Z')); | ||
// true | ||
isOfficeHours(new Date('2019-03-04T16:59:59.000Z')); | ||
// true | ||
isOfficeHours(new Date('2019-03-04T17:00:00.000Z')); | ||
// false | ||
isOfficeHours(new Date('2019-03-04T17:01:00.000Z')); | ||
// false | ||
``` | ||
|
||
### outsideOfficeHours | ||
|
||
If the provided date falls within Office Hours, a new date is returned with the | ||
time adjusted to fall outside Office Hours. If the provided date falls outside | ||
Office Hours, it is returned unchanged. | ||
|
||
The provided date is never mutated. | ||
|
||
```js | ||
import { outsideOfficeHours } from 'is-office-hours'; | ||
|
||
outsideOfficeHours(new Date('2019-03-04T09:00:00.000Z')); | ||
// Date(2019-03-04T18:00:00.000Z) | ||
outsideOfficeHours(new Date('2019-03-04T10:00:00.000Z')); | ||
// Date(2019-03-04T18:37:29.000Z) | ||
outsideOfficeHours(new Date('2019-03-04T11:00:00.000Z')); | ||
// Date(2019-03-04T19:14:59.000Z) | ||
outsideOfficeHours(new Date('2019-03-04T12:00:00.000Z')); | ||
// Date(2019-03-04T19:52:29.000Z) | ||
outsideOfficeHours(new Date('2019-03-04T13:00:00.000Z')); | ||
// Date(2019-03-04T20:29:59.000Z) | ||
outsideOfficeHours(new Date('2019-03-04T14:00:00.000Z')); | ||
// Date(2019-03-04T21:07:29.000Z) | ||
outsideOfficeHours(new Date('2019-03-04T15:00:00.000Z')); | ||
// Date(2019-03-04T21:44:59.000Z) | ||
outsideOfficeHours(new Date('2019-03-04T16:00:00.000Z')); | ||
// Date(2019-03-04T22:22:29.000Z) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters