Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

opentable/ot-availability-phrases

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

nodejs code for generating availability-phrases

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors