{"id":15862466,"url":"https://github.com/jamiemason/is-office-hours","last_synced_at":"2025-10-07T02:25:05.881Z","repository":{"id":51785473,"uuid":"174571619","full_name":"JamieMason/is-office-hours","owner":"JamieMason","description":"Determine whether a given date is within office hours","archived":false,"fork":false,"pushed_at":"2021-05-10T01:15:08.000Z","size":336,"stargazers_count":2,"open_issues_count":13,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-18T19:33:18.740Z","etag":null,"topics":["business-hours","business-time","date-time","dates","datetime","office-hours","times","working-day","working-hours"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/is-office-hours","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamieMason.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"open_collective":"fold_left","custom":["https://www.paypal.me/foldleft"]}},"created_at":"2019-03-08T16:31:05.000Z","updated_at":"2022-07-02T06:46:03.000Z","dependencies_parsed_at":"2022-09-18T15:31:24.367Z","dependency_job_id":null,"html_url":"https://github.com/JamieMason/is-office-hours","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamieMason%2Fis-office-hours","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamieMason%2Fis-office-hours/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamieMason%2Fis-office-hours/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamieMason%2Fis-office-hours/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamieMason","download_url":"https://codeload.github.com/JamieMason/is-office-hours/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801635,"owners_count":20350107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["business-hours","business-time","date-time","dates","datetime","office-hours","times","working-day","working-hours"],"created_at":"2024-10-05T22:40:52.459Z","updated_at":"2025-10-07T02:25:00.853Z","avatar_url":"https://github.com/JamieMason.png","language":"TypeScript","funding_links":["https://opencollective.com/fold_left","https://www.paypal.me/foldleft"],"categories":[],"sub_categories":[],"readme":"# is-office-hours\n\n\u003e Determine whether a given date is within office hours\n\n[![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)\n\n## Table of Contents\n\n-   [🌩 Installation](#-installation)\n-   [🕹 Usage](#-usage)\n-   [🙋🏽‍♀️ Getting Help](#♀️-getting-help)\n-   [👀 Other Projects](#-other-projects)\n-   [🤓 Author](#-author)\n\n## 🌩 Installation\n\n    npm install --save is-office-hours\n\n## 🕹 Usage\n\n### isOfficeHours\n\nReturns `true` if the provided `Date` falls within Monday to Friday 9:00am to 4:59pm.\n\n```js\nimport { isOfficeHours } from \"is-office-hours\";\n\nisOfficeHours(new Date(\"2019-03-04T08:59:59.000Z\"));\n// false\nisOfficeHours(new Date(\"2019-03-04T09:00:00.000Z\"));\n// true\nisOfficeHours(new Date(\"2019-03-04T09:01:00.000Z\"));\n// true\nisOfficeHours(new Date(\"2019-03-04T16:59:59.000Z\"));\n// true\nisOfficeHours(new Date(\"2019-03-04T17:00:00.000Z\"));\n// false\nisOfficeHours(new Date(\"2019-03-04T17:01:00.000Z\"));\n// false\n```\n\n### outsideOfficeHours\n\nIf 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.\n\nThe provided date is never mutated.\n\n```js\nimport { outsideOfficeHours } from \"is-office-hours\";\n\noutsideOfficeHours(new Date(\"2019-03-04T09:00:00.000Z\"));\n// Date(2019-03-04T18:00:00.000Z)\noutsideOfficeHours(new Date(\"2019-03-04T10:00:00.000Z\"));\n// Date(2019-03-04T18:37:29.000Z)\noutsideOfficeHours(new Date(\"2019-03-04T11:00:00.000Z\"));\n// Date(2019-03-04T19:14:59.000Z)\noutsideOfficeHours(new Date(\"2019-03-04T12:00:00.000Z\"));\n// Date(2019-03-04T19:52:29.000Z)\noutsideOfficeHours(new Date(\"2019-03-04T13:00:00.000Z\"));\n// Date(2019-03-04T20:29:59.000Z)\noutsideOfficeHours(new Date(\"2019-03-04T14:00:00.000Z\"));\n// Date(2019-03-04T21:07:29.000Z)\noutsideOfficeHours(new Date(\"2019-03-04T15:00:00.000Z\"));\n// Date(2019-03-04T21:44:59.000Z)\noutsideOfficeHours(new Date(\"2019-03-04T16:00:00.000Z\"));\n// Date(2019-03-04T22:22:29.000Z)\n```\n\n## 🙋🏽‍♀️ Getting Help\n\nGet help with issues by creating a [Bug Report] or discuss ideas by opening a [Feature Request].\n\n[bug report]: https://github.com/JamieMason/is-office-hours/issues/new?template=bug_report.md\n\n[feature request]: https://github.com/JamieMason/is-office-hours/issues/new?template=feature_request.md\n\n## 👀 Other Projects\n\nIf you find my Open Source projects useful, please share them ❤️\n\n-   [**eslint-formatter-git-log**](https://github.com/JamieMason/eslint-formatter-git-log)\u003cbr\u003eESLint Formatter featuring Git Author, Date, and Hash\n-   [**eslint-plugin-move-files**](https://github.com/JamieMason/eslint-plugin-move-files)\u003cbr\u003eMove and rename files while keeping imports up to date\n-   [**eslint-plugin-prefer-arrow-functions**](https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions)\u003cbr\u003eConvert functions to arrow functions\n-   [**ImageOptim-CLI**](https://github.com/JamieMason/ImageOptim-CLI)\u003cbr\u003eAutomates ImageOptim, ImageAlpha, and JPEGmini for Mac to make batch optimisation of images part of your automated build process.\n-   [**Jasmine-Matchers**](https://github.com/JamieMason/Jasmine-Matchers)\u003cbr\u003eWrite Beautiful Specs with Custom Matchers\n-   [**karma-benchmark**](https://github.com/JamieMason/karma-benchmark)\u003cbr\u003eRun Benchmark.js over multiple Browsers, with CI compatible output\n-   [**self-help**](https://github.com/JamieMason/self-help#readme)\u003cbr\u003eInteractive Q\u0026A Guides for Web and the Command Line\n-   [**syncpack**](https://github.com/JamieMason/syncpack#readme)\u003cbr\u003eManage multiple package.json files, such as in Lerna Monorepos and Yarn Workspaces\n\n## 🤓 Author\n\n\u003cimg src=\"https://www.gravatar.com/avatar/acdf106ce071806278438d8c354adec8?s=100\" align=\"left\"\u003e\n\nI'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.\n\n\u003cdiv align=\"center\"\u003e\n\n[![Follow JamieMason on GitHub][github badge]][github]      [![Follow fold_left on Twitter][twitter badge]][twitter]\n\n\u003c/div\u003e\n\n\u003c!-- images --\u003e\n\n[github badge]: https://img.shields.io/github/followers/JamieMason.svg?style=social\u0026label=Follow\n\n[twitter badge]: https://img.shields.io/twitter/follow/fold_left.svg?style=social\u0026label=Follow\n\n\u003c!-- links --\u003e\n\n[arsenal]: https://www.arsenal.com\n\n[betfair]: https://www.betfair.com\n\n[github]: https://github.com/JamieMason\n\n[jamie mason]: https://www.linkedin.com/in/jamiemasonleeds\n\n[leeds united]: https://www.leedsunited.com/\n\n[leeds]: https://www.instagram.com/visitleeds\n\n[premier league]: https://www.premierleague.com\n\n[shell]: https://www.shell.com\n\n[sky bet]: https://www.skybet.com\n\n[sky poker]: https://www.skypoker.com\n\n[sky sports]: https://www.skysports.com\n\n[spurs]: https://www.tottenhamhotspur.com\n\n[twitter]: https://twitter.com/fold_left\n\n[west ham]: https://www.whufc.com\n\n[william hill]: https://www.williamhill.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamiemason%2Fis-office-hours","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamiemason%2Fis-office-hours","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamiemason%2Fis-office-hours/lists"}