1.4.2 • Published 5 years ago

openinghour-shorten v1.4.2

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

openinghour-shorten

Build Status Coverage Status

shorten google map opening hour data

Install

$ npm install --save openinghour-shorten
$ yarn add openinghour-shorten

Usage

import openinghourShorten from 'openinghour-shorten';
//OR const openinghourShorten = require('openinghour-shorten');

// google map api response: result.opening_hours.periods
const openingHour = [
  { close: { day: 0, time: '2100' }, open: { day: 0, time: '1000' } },
  { close: { day: 1, time: '2100' }, open: { day: 1, time: '1100' } },
  { close: { day: 2, time: '2100' }, open: { day: 2, time: '1100' } },
  { close: { day: 3, time: '2100' }, open: { day: 3, time: '1100' } },
  { close: { day: 4, time: '2100' }, open: { day: 4, time: '1100' } },
  { close: { day: 5, time: '2200' }, open: { day: 5, time: '1100' } },
  { close: { day: 6, time: '2200' }, open: { day: 6, time: '1000' } }
];

openinghourShorten(openingHour);
//=> Sun 10:00~21:00; Mon-Thu 11:00~21:00; Fri 11:00~22:00; Sat 10:00~22:00

openinghourShorten(openingHour, { startByMonday: true });
//=> Mon-Thu 11:00~21:00; Fri 11:00~22:00; Sat 10:00~22:00; Sun 10:00~21:00

openinghourShorten(openingHour, { format12Hr: true });
//=> Sun 10:00AM~09:00PM; Mon-Thu 11:00AM~09:00PM; Fri 11:00AM~10:00PM; Sat 10:00AM~10:00PM

What's Next

License

MIT © Oahehc

Contributors

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago