Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

honeycombbe-select-time

jonmnick15ISC1.0.6TypeScript support: included

npm i honeycombbe-select-time

readme

Install

npm i honeycombbe-select-time

Use Case

This package helps to format time ranges for a specified date. Useful for some calendaring applications, but primary used to generate time slots for users to pick from a drop-down (select) menu.

Setup 

import * as selectTime from 'honeycombbe-select-time';
/*
OR
*/
const selectTime = require('honeycombbe-select-time');

var config = {
    start: '8:00AM', //Start time in h:mma format
    end: '8:00PM', // End time in h:mma format
    date: '2019-12-01', // Date the slots are built upon in YYYY-MM-DD format
    interval: 15, //Slots interval in minutes
    timezone: 'America/Chicago'
};

selectTime.init(config);
console.log(selectTime.slots());

Returns

    [
        {
            display: '08:00AM',
            timestamp: 1575208800
        },
        {
            display: '08:15AM',
            timestamp: 1575209700
        }
        ...
    ]