ot-availability-phrases
v0.3.1
Published
Utility functions for dealing with availability phrases
Downloads
6
Keywords
Readme
ot-availability-phrases
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-parserschedule: array of days with an array of time-ranges for each
Running tests
npm install
npm test