This is a little utility to help parse hours of operation strings.
A string that contains the hours of operation for a business can come in many different forms. For example:
This library is an attempt to normalize any of these typical variations and output either a standard JSON data structure that contains all the hours or a specific format.
From the command line enter:
npm install hrsoo -g
hrsoo -i "Monday through Friday 9 a.m. to 5 p.m."
From the command line enter:
npm install hrsoo --save
Then in your Node.js code use the library like this:
var hrsoo = require('hrsoo');
var formatted = hrsoo.format('Monday through Friday 9 a.m. to 5 p.m.');
Include dist/hrsoo.min.js in your client build and reference it in a script tag on your page. Then simply:
var formatted = hrsoo.format('Monday through Friday 9 a.m. to 5 p.m.');
A couple of things I am still working on: