Skip to content

Commit

Permalink
docs(readme): update readme template
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMason committed Sep 19, 2019
1 parent 2f4e21b commit a57346f
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 36 deletions.
58 changes: 58 additions & 0 deletions .github/README_CONTENT.md
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)
```
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.md
138 changes: 103 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,143 @@

> Determine whether a given date is within office hours
[![NPM version](http://img.shields.io/npm/v/is-office-hours.svg?style=flat-square)](https://www.npmjs.com/package/is-office-hours)
[![NPM downloads](http://img.shields.io/npm/dm/is-office-hours.svg?style=flat-square)](https://www.npmjs.com/package/is-office-hours)
[![Build Status](http://img.shields.io/travis/JamieMason/is-office-hours/master.svg?style=flat-square)](https://travis-ci.org/JamieMason/is-office-hours)
[![Maintainability](https://api.codeclimate.com/v1/badges/bced12a42a2c6d08219c/maintainability)](https://codeclimate.com/github/JamieMason/is-office-hours/maintainability)
[![Follow JamieMason on GitHub](https://img.shields.io/github/followers/JamieMason.svg?style=social&label=Follow)](https://github.com/JamieMason)
[![Follow fold_left on Twitter](https://img.shields.io/twitter/follow/fold_left.svg?style=social&label=Follow)](https://twitter.com/fold_left)
[![NPM version](http://img.shields.io/npm/v/is-office-hours.svg?style=flat-square)](https://www.npmjs.com/package/is-office-hours) [![NPM downloads](http://img.shields.io/npm/dm/is-office-hours.svg?style=flat-square)](https://www.npmjs.com/package/is-office-hours) [![Build Status](http://img.shields.io/travis/JamieMason/is-office-hours/master.svg?style=flat-square)](https://travis-ci.org/JamieMason/is-office-hours) [![Maintainability](https://api.codeclimate.com/v1/badges/bced12a42a2c6d08219c/maintainability)](https://codeclimate.com/github/JamieMason/is-office-hours/maintainability)

## Table of Contents

- [🌩 Installation](#-installation)
- [🕹 Usage](#-usage)
- [🙋🏽‍♀️ Getting Help](#♀️-getting-help)
- [👀 Other Projects](#-other-projects)
- [🤓 Author](#-author)

## 🌩 Installation

```
npm install --save is-office-hours
```
npm install --save is-office-hours

## 🕹 Usage

### isOfficeHours

Returns `true` if the provided `Date` falls within Monday to Friday 9:00am to
4:59pm.
Returns `true` if the provided `Date` falls within Monday to Friday 9:00am to 4:59pm.

```js
import { isOfficeHours } from 'is-office-hours';
import { isOfficeHours } from "is-office-hours";

isOfficeHours(new Date('2019-03-04T08:59:59.000Z'));
isOfficeHours(new Date("2019-03-04T08:59:59.000Z"));
// false
isOfficeHours(new Date('2019-03-04T09:00:00.000Z'));
isOfficeHours(new Date("2019-03-04T09:00:00.000Z"));
// true
isOfficeHours(new Date('2019-03-04T09:01:00.000Z'));
isOfficeHours(new Date("2019-03-04T09:01:00.000Z"));
// true
isOfficeHours(new Date('2019-03-04T16:59:59.000Z'));
isOfficeHours(new Date("2019-03-04T16:59:59.000Z"));
// true
isOfficeHours(new Date('2019-03-04T17:00:00.000Z'));
isOfficeHours(new Date("2019-03-04T17:00:00.000Z"));
// false
isOfficeHours(new Date('2019-03-04T17:01:00.000Z'));
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.
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';
import { outsideOfficeHours } from "is-office-hours";

outsideOfficeHours(new Date('2019-03-04T09:00:00.000Z'));
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'));
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'));
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'));
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'));
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'));
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'));
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'));
outsideOfficeHours(new Date("2019-03-04T16:00:00.000Z"));
// Date(2019-03-04T22:22:29.000Z)
```

## 🙋🏾‍♀️ Getting Help
## 🙋🏽‍♀️ Getting Help

Get help with issues by creating a [Bug Report] or discuss ideas by opening a [Feature Request].

[bug report]: https://github.com/JamieMason/is-office-hours/issues/new?template=bug_report.md

[feature request]: https://github.com/JamieMason/is-office-hours/issues/new?template=feature_request.md

## 👀 Other Projects

If you find my Open Source projects useful, please share them ❤️

- [**add-matchers**](https://github.com/JamieMason/add-matchers)<br>Write useful test matchers compatible with Jest and Jasmine.
- [**eslint-formatter-git-log**](https://github.com/JamieMason/eslint-formatter-git-log)<br>ESLint Formatter featuring Git Author, Date, and Hash
- [**eslint-plugin-move-files**](https://github.com/JamieMason/eslint-plugin-move-files)<br>Move and rename files while keeping imports up to date
- [**eslint-plugin-prefer-arrow-functions**](https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions)<br>Convert functions to arrow functions
- [**get-time-between**](https://github.com/JamieMason/get-time-between#readme)<br>Measure the amount of time during work hours between two dates
- [**image-optimisation-tools-comparison**](https://github.com/JamieMason/image-optimisation-tools-comparison)<br>A benchmarking suite for popular image optimisation tools.
- [**ImageOptim-CLI**](https://github.com/JamieMason/ImageOptim-CLI)<br>Automates ImageOptim, ImageAlpha, and JPEGmini for Mac to make batch optimisation of images part of your automated build process.
- [**Jasmine-Matchers**](https://github.com/JamieMason/Jasmine-Matchers)<br>Write Beautiful Specs with Custom Matchers
- [**jest-fail-on-console-reporter**](https://github.com/JamieMason/jest-fail-on-console-reporter#readme)<br>Disallow untested console output produced during tests
- [**karma-benchmark**](https://github.com/JamieMason/karma-benchmark)<br>Run Benchmark.js over multiple Browsers, with CI compatible output
- [**karma-jasmine-matchers**](https://github.com/JamieMason/karma-jasmine-matchers)<br>A Karma plugin - Additional matchers for the Jasmine BDD JavaScript testing library.
- [**logservable**](https://github.com/JamieMason/logservable)<br>git log as an observable stream of JSON objects
- [**self-help**](https://github.com/JamieMason/self-help#readme)<br>Interactive Q&A Guides for Web and the Command Line
- [**syncpack**](https://github.com/JamieMason/syncpack#readme)<br>Manage multiple package.json files, such as in Lerna Monorepos and Yarn Workspaces

## 🤓 Author

<img src="https://www.gravatar.com/avatar/acdf106ce071806278438d8c354adec8?s=100" align="left">

I'm [Jamie Mason] from [Leeds] in England, I began Web Design and Development in 1999 and have been Contracting and offering Consultancy as Fold Left Ltd since 2012. Who I've worked with includes [Sky Sports], [Sky Bet], [Sky Poker], The [Premier League], [William Hill], [Shell], [Betfair], and Football Clubs including [Leeds United], [Spurs], [West Ham], [Arsenal], and more.

<div align="center">

[![Follow JamieMason on GitHub][github badge]][github]      [![Follow fold_left on Twitter][twitter badge]][twitter]

</div>

<!-- images -->

[github badge]: https://img.shields.io/github/followers/JamieMason.svg?style=social&label=Follow

[twitter badge]: https://img.shields.io/twitter/follow/fold_left.svg?style=social&label=Follow

<!-- links -->

[arsenal]: https://www.arsenal.com

[betfair]: https://www.betfair.com

[github]: https://github.com/JamieMason

[jamie mason]: https://www.linkedin.com/in/jamiemasonleeds

[leeds united]: https://www.leedsunited.com/

[leeds]: https://www.instagram.com/visitleeds

[premier league]: https://www.premierleague.com

[shell]: https://www.shell.com

[sky bet]: https://www.skybet.com

[sky poker]: https://www.skypoker.com

[sky sports]: https://www.skysports.com

[spurs]: https://www.tottenhamhotspur.com

[twitter]: https://twitter.com/fold_left

[west ham]: https://www.whufc.com

- Get help with issues by creating a
[Bug Report](https://github.com/JamieMason/is-office-hours/issues/new?template=bug_report.md).
- Discuss ideas by opening a
[Feature Request](https://github.com/JamieMason/is-office-hours/issues/new?template=feature_request.md).
[william hill]: https://www.williamhill.com
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"repository": "JamieMason/is-office-hours",
"scripts": {
"build": "tsc --project .",
"format": "prettier --write '**/*.md' './src/**/*.ts'",
"format": "prettier --write './src/**/*.ts'",
"lint": "tslint --fix --project ./tsconfig.json",
"prebuild": "rimraf dist",
"prelint": "npm run format",
Expand Down

0 comments on commit a57346f

Please sign in to comment.