ot-availability-phrases

0.3.1 • Public • Published

ot-availability-phrases

Build Status NPM version Dependencies

Generate availability phrases from a day-schedule:

e.g.

"Mon-Fri 11:00-22:00"

installation:

npm install ot-availability-phrases

usage:

var builder = require('ot-availability-phrases');

var phrases = builder.getAvailabilityPhrases('en-GB', [
  {
    DayOfWeek: 0,
    Schedule: [{
      First: '09:35:00',
      Last: '14:15:00'
    }] 
  },
  {
    DayOfWeek: 1,
    Schedule: [{
      First: '09:35:00',
      Last: '14:15:00'
    }] 
  }
]);

console.log(phrases[0]);
// "Sun-Mon 09:35-14:15"

getAvailabilityPhrases(locale, schedule)

  • locale: can either be a string (e.g. en-GB, en) or an array of languages (sorted by quality) [{ code: 'en', region: 'GB', quality: 1.0}, ... ] (as given by accept-language-parser

  • schedule: array of days with an array of time-ranges for each

Running tests

npm install
npm test

Readme

Keywords

Package Sidebar

Install

npm i ot-availability-phrases

Weekly Downloads

0

Version

0.3.1

License

MIT

Last publish

Collaborators

  • acolchado
  • arnoldzokas
  • matteofigus
  • christriddle
  • ryantomlinson
  • andyroyle
  • stevejhiggs