Skip to content
This repository has been archived by the owner on May 21, 2020. It is now read-only.
/ time2input Public archive

A helper to manage 2 time inputs with increment/decrement

Notifications You must be signed in to change notification settings

etcdigital/time2input

Repository files navigation

time2input - Deprecated, use @fordate instead

A helper to manage 2 time inputs with increment/decrement on second input when the first changes.

How to use

npm install time2input --save-dev or yarn add -D time2input.

const inputTimeChange = require('time2input');
const beginTime = '08:00';
const endTime = '09:00';
const intervalInMinutes = 15;
const thisInputIs = 'begin'; // or "end"
const action = 'down'; // up to sum or down to substract
const newInputTimes = inputTimeChange(beginTime, endTime, intervalInMinutes, thisInputIs, action);
// newInputTimes = { begin: '07:45', end: '09:00' }