Time
Time is a JavaScript class for converting time between units. All operations are immutable and return new Time
instances instead of modifying the current instance.
Installation
npm install @dlevs/time
Overview
import Time from '@dlevs/time';
const time = new Time({ days: 1 });
time.toMilliseconds();
time.toSeconds();
time.toMinutes();
time.toHours();
time.toDays();
time.toComponents();
time.add({ hours: 12 }).toDays();
time.subtract({ days: 2 }).toDays();
time.multiply(2).toDays();
time.divide(2).toDays();
Documentation
View the API documentation for more details and example usage.