UNPKG

timeperiodjs

Version:
22 lines (21 loc) 587 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Duration { constructor(durationInMilliseconds) { this._duration = durationInMilliseconds; } get inMilliseconds() { return this._duration; } get inSeconds() { return this._duration / 1000; } get inMinutes() { return this.inSeconds / 60; } get inHours() { return this.inMinutes / 60; } } exports.default = Duration; Duration.getDurationBetween = (from, to) => new Duration(to.getTime() - from.getTime());