Catalog npm
Back to packageRELEASE DETAILS

0.2.0

npm

1-line-opening-hours

Simple parser for OpenStreetMap `opening_hours`

opening_hoursopenstreetmaposmtimetable
Published12 Apr 2021
Direct dependencies7
Transitive dependenciesNot calculated

README

Current package documentation

1-line-opening-hours

Get rid of heavy responses from API when using simple opening hours, by using the OpenStreetMap opening_hours format.

This was first forked from wbkd. The project then aimed to be bigger, so a lot of code has been rewrote and new features added.

It only supports the human readable parts and not this complete crazy overengineered specification.

Supported opening_hours examples

  • Mo-Sa 06:00-22:00
  • Mo-Fr 08:00-18:00; Sa 10:00-14:00
  • Mo-Fr 08:00-18:00; Sa,Su 10:00-20:00
  • Mo-Fr 08:00-12:00, We 14:00-18:00
  • Mo-Fr 08:00-12:00, 14:00-18:00
  • Mo-Fr 08:00+
  • Mo-Fr 08:00-01:00
  • Mo-Fr 08:00-18:00; We off
  • 24/7

Getting started

Install

npm install 1-line-opening-hours --save
yarn add 1-line-opening-hours

Usage

const openingHours = new OpeningHours('Mo-Sa 06:00-22:00');

console.log('Is this open now?', openingHours.isOpenNow());
console.log('Is this open on 2016-10-01 18:00?', openingHours.isOpenOn(new Date('2016-10-01 18:00')));
console.table(openingHours.getTable());

API

MethodDescriptionReturn value
isOpenNow()Check whether the establishment is open now based on the provided opening hourtrue or false
isOpenOn(date: Date)Same than above for any datetrue or false
getTable()Get an array of each day and the corresponding opening time{ su: [], mo: ['06:00-22:00'] ... }
getFullStatusOfToday()Send more information about the current opening status, the next day that it will be opened...{ open: false openUntil: null, nextReopening: { hour: '11:00', day: 'tu', opensInDay: 0 }
getFullStatusOfDay(date: Date)Same than above for any date{ open: false openUntil: null, nextReopening: { hour: '11:00', day: 'tu', opensInDay: 0 }

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 7

Native requirements
7 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@types/jest
Environment
{
  "local_name": "@types/jest",
  "alias": false,
  "peer_metadata": null
}
^26.0.22development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^14.14.37development
jest
Environment
{
  "local_name": "jest",
  "alias": false,
  "peer_metadata": null
}
^26.6.3development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
^2.2.1development
ts-jest
Environment
{
  "local_name": "ts-jest",
  "alias": false,
  "peer_metadata": null
}
^26.5.4development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^3.3.4000development
yarn-or-npm
Environment
{
  "local_name": "yarn-or-npm",
  "alias": false,
  "peer_metadata": null
}
^3.0.1development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-rOLBNMJMbm46Hh9fTT9mPzQ5Dzm3ohhnH3OnxzIs4hB4wDPEsEG65MPQK34h/DIYlrsYDaBlBMpjy2BoQuo/TA==",
  "shasum": "44f64e3568145e74fb3f4cd238bb053b61df0eef",
  "tarball": "https://registry.npmjs.org/1-line-opening-hours/-/1-line-opening-hours-0.2.0.tgz",
  "fileCount": 6,
  "unpackedSize": 21062,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgdDHpCRA9TVsSAnZWagAAApMP/0UU2giT/qldIXijsKgc\n4vAxzLlpF6pJc0Dm9XyrdyD3E6hBhTmByLM1tydfmg6Oq6v0xyfPqN+EQoJQ\naVf1zb4Eb6c7Gw3O6uL/6LvBw2E1Sd4cIzxNVoTg32WKyaX6g49bsDu+v57D\nYygD51zCg34o+1uLphyFl/d1eJH9zsTS/4maT1jJAMj+nyWSXo4MmyqOOt6l\nb3HjipcPQn3O0ZlblNRgrgMIDuDOW3ELEW+abTFbWyLBqW3I2EnLOJLoLGp/\n+Snkcf/LSihv64pCAQI07jdw+jcUirXCJbFTViQeGrlfYOaUzRPdMGB7LyvW\nvCv68r3oYHqxWr10T2RV/vxmIc+Xzu4LR2DqWu1q+MqUaYD0AU5cJa0Oym1m\nY+WYhUZeJc3nGmjPu23c5lMbUE8FKOJsUNQmZ+SCkKtEqmy3fl9dddSfONFB\nwYEdiiXbD8MNABLlkLGubT1qNvUz7jbQv0j02cGXA2z0sYU/PrzxnTWLZP5i\nhgVTM5DqppUECeeJiGicw/6khBZo6EDnE6Qi6wzcW/lDnlzuAYd0DZ7V6s44\nd3edAmhLxIlwrzzf4X4smENKWABFMBI3EZ2znSdHaN+1ml1qKb/Z5Yt1+kkA\nzqzXoAWNRFr8tAk6T105KZhhVA2twUhdwZA/+HraDs8kSquPtNYoe016LEhP\nrXg5\r\n=E+xG\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQDdKEi6EkQ6OD3T6+eoZ3hqq9UvcquhYi+wzszSQJuNawIhAIEhOffTYrVslZJgr1r+5LiMX3IMxDoy3oc4wajuKgJj"
    }
  ]
}

Repository

PENDING
snowpact/1-line-opening-hours

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:55 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:5fcba67b6a34573445feeeb8637f490a832b267aa8c40ea07c739a1b10da88b3

Other collected versions

0.3.225 Apr0.3.121 Apr0.3.021 Apr0.2.119 AprView all collected versions →