vail/static/scripts/time.mjs

19 lines
468 B
JavaScript
Raw Normal View History

2022-05-08 11:33:25 -06:00
/**
* A time duration.
*
* JavaScript uses milliseconds in most (but not all) places.
* I've found it helpful to be able to multiply by a unit, so it's clear what's going on.
*
* @typedef {number} Duration
*/
/** @type {Duration} */
2023-01-17 12:25:20 -07:00
const Millisecond = 1
2022-05-08 11:33:25 -06:00
/** @type {Duration} */
2023-01-17 12:25:20 -07:00
const Second = 1000 * Millisecond
2022-05-08 11:33:25 -06:00
/** @type {Duration} */
2023-01-17 12:25:20 -07:00
const Minute = 60 * Second
2022-05-08 11:33:25 -06:00
/** @type {Duration} */
2023-01-17 12:25:20 -07:00
const Hour = 60 * Minute
export {Millisecond, Second, Minute, Hour}