{"id":16721178,"url":"https://github.com/khalyomede/opened-closed","last_synced_at":"2026-01-16T00:39:54.713Z","repository":{"id":33872118,"uuid":"162493739","full_name":"khalyomede/opened-closed","owner":"khalyomede","description":"Provides availabiltiy and near-to-close information from periods.","archived":false,"fork":false,"pushed_at":"2023-01-04T21:52:40.000Z","size":3275,"stargazers_count":0,"open_issues_count":21,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T01:35:16.093Z","etag":null,"topics":["availability","close-in","closed","closing","hours","javascript","nodejs","npm","npm-package","opened","opening-hours","opens-in"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/opened-closed","language":"JavaScript","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/khalyomede.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-19T21:40:48.000Z","updated_at":"2020-01-01T18:32:37.000Z","dependencies_parsed_at":"2023-01-15T03:15:19.420Z","dependency_job_id":null,"html_url":"https://github.com/khalyomede/opened-closed","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fopened-closed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fopened-closed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fopened-closed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalyomede%2Fopened-closed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khalyomede","download_url":"https://codeload.github.com/khalyomede/opened-closed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246911496,"owners_count":20853654,"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":["availability","close-in","closed","closing","hours","javascript","nodejs","npm","npm-package","opened","opening-hours","opens-in"],"created_at":"2024-10-12T22:29:12.332Z","updated_at":"2026-01-16T00:39:54.700Z","avatar_url":"https://github.com/khalyomede.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Opened Closed\n\n![Version](https://img.shields.io/npm/v/opened-closed.svg)\n![License](https://img.shields.io/npm/l/opened-closed.svg) ![Gzip \u0026 minified size](https://img.shields.io/bundlephobia/minzip/opened-closed.svg)\n\n![](https://img.shields.io/codeship/ca85c7c0-e8cc-0136-0c9e-7620f6fdb86b.svg)\n[![Coverage Status](https://coveralls.io/repos/github/khalyomede/opened-closed/badge.svg?branch=master)](https://coveralls.io/github/khalyomede/opened-closed?branch=master)\n![Mutations](https://img.shields.io/badge/mutations-0.00%25-brightgreen.svg)\n[![Known Vulnerabilities](https://snyk.io/test/github/khalyomede/opened-closed/badge.svg?targetFile=package.json)](https://snyk.io/test/github/khalyomede/opened-closed?targetFile=package.json) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/opened-closed)\n\nProvides availabiltiy and near-to-close information from periods.\n\n```javascript\nconst OpenedClosed = require(\"opened-closed\");\n\nconst store = new OpenedClosed({\n  timezone: \"GMT+0100\",\n  openings: {\n    monday: [\n      { start: \"10:00\", end: \"13:00\" },\n      { start: \"15:00\", end: \"18:00\" }\n    ]\n  }\n});\n\nconsole.log(store.opened());\n```\n\n## Summary\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [API](api.md)\n- [Contributing](#contributing)\n\n## Installation\n\n- [Web](#web)\n- [NPM](#npm)\n\n### Web\n\nInclude the following script in your project:\n\n```html\n\u003cscript\n  type=\"text/javascript\"\n  src=\"https://raw.githack.com/khalyomede/opened-closed/master/dist/opened-closed.min.js\"\n\u003e\u003c/script\u003e\n```\n\n### NPM\n\n1. Include Opened Closed in your dependencies:\n\n```bash\nnpm install --save opened-closed@0.*\n```\n\n2. Import it in your script:\n\n```bash\nconst OpenedClosed = require('opened-closed');\n```\n\n## Usage\n\nAll the examples can be found in the folder `example` of this repository.\n\n- [Example 1: checking if a store is opened now](#example-1-checking-if-a-store-is-opened-now)\n- [Example 2: adding exceptional closings dates](#example-2-adding-exceptional-closings-dates)\n- [Example 3: getting the opening state as a string](#example-3-getting-the-opening-state-as-a-string)\n- [Example 4: changing the language](#example-4-changing-the-language)\n- [Example 5: get the \"store closes in\" in seconds](#example-5-get-the-store-closes-in-in-seconds)\n- [Example 6: get the \"store closes in\" as a date](#example-6-get-the-store-closes-in-as-a-date)\n\n### Example 1: checking if a store is opened now\n\n```javascript\nconst OpenedClosed = require(\"opened-closed\");\n\nconst store = new OpenedClosed({\n  timezone: \"GMT+0100\",\n  openings: {\n    monday: [\n      { start: \"10:00\", end: \"13:00\" },\n      { start: \"15:00\", end: \"18:00\" }\n    ]\n  }\n});\n\nconsole.log(store.opened());\n```\n\n### Example 2: adding exceptional closings dates\n\n```javascript\nconst OpenedClosed = require(\"opened-closed\");\n\nconst store = new OpenedClosed({\n  timezone: \"GMT+0100\",\n  openings: {\n    monday: [\n      { start: \"10:00\", end: \"13:00\" },\n      { start: \"15:00\", end: \"18:00\" }\n    ],\n    tuesday: [\n      { start: \"10:00\", end: \"13:00\" },\n      { start: \"15:00\", end: \"18:00\" }\n    ]\n  },\n  closings: [\n    {\n      reason: \"Christmas\", // optional\n      from: new Date(\"2018-12-25 00:00:00 GMT+0100\"),\n      to: new Date(\"2018-12-25 23:59:59 GMT+0100\")\n    }\n  ]\n});\n```\n\n### Example 3: getting the opening state as a string\n\n```javascript\nconst OpenedClosed = require(\"opened-closed\");\n\nconst store = new OpenedClosed({\n  timezone: \"GMT+0100\",\n  openings: {\n    monday: [\n      { start: \"10:00\", end: \"13:00\" },\n      { start: \"15:00\", end: \"18:00\" }\n    ]\n  }\n});\n\nconsole.log(store.availability());\n```\n\n### Example 4: changing the language\n\n```javascript\nconst OpenedClosed = require(\"opened-closed\");\n\nconst store = new OpenedClosed({\n  timezone: \"GMT+0100\",\n  openings: {\n    monday: [\n      { start: \"10:00\", end: \"13:00\" },\n      { start: \"15:00\", end: \"18:00\" }\n    ]\n  },\n  language: {\n    opened: \"ouvert\",\n    closed: \"fermé\"\n  }\n});\n\nconsole.log(store.availability());\n```\n\n### Example 5: get the store closes in in seconds\n\n```javascript\nconst OpenedClosed = require(\"opened-closed\");\n\nconst store = new OpenedClosed({\n  timezone: \"GMT+0100\",\n  openings: {\n    monday: [\n      { start: \"10:00\", end: \"13:00\" },\n      { start: \"15:00\", end: \"18:00\" }\n    ]\n  }\n});\n\nif (store.opened()) {\n  console.log(\"closes in\", store.closeIn());\n} else {\n  console.log(store.availability());\n}\n```\n\n### Example 6: get the store closes in as a date\n\n```javascript\nconst OpenedClosed = require(\"opened-closed\");\n\nconst store = new OpenedClosed({\n  timezone: \"GMT+0100\",\n  openings: {\n    wednesday: [{ start: \"10:00\", end: \"19:00\" }]\n  }\n});\n\nif (store.opened()) {\n  const closeAt = store.closeAt().toLocaleString(); // Maybe GMT+01 is not yours, so LocalString take care of it.\n\n  console.log(\"will close at\", closeAt);\n} else {\n  console.log(store.availability()); // \"closed\"\n}\n```\n\n## Contributing\n\n- The code is located in `src/main.ts`. This is in TypeScript, but it also support plain JavaScript if you prefer.\n- I prefer no dependencies for the moment, because this is help making a working web solution (opened to suggestions to improve the workflow).\n- The web solution is simply removing the export statement, and using Gulp to transpile TypeScript in ES5 (opened to suggestions to improve the workflow).\n\n1. Create an issue\n2. Create a branche with the number of the issue in it: `git checkout -b issue-36`\n3. Create tests inside `test/`\n4. Light on dev: `npm run dev`\n5. Make your changes on `src/main.ts`\n6. Run test using `npm run test`\n7. Copy `main.ts` in `opened-closed.ts`, remove the `export = OpenedClosed;` line\n8. Run `npm run prod`\n9. Create a Pull Request from your branch to master\n\nThank you for your time!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalyomede%2Fopened-closed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhalyomede%2Fopened-closed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalyomede%2Fopened-closed/lists"}