Mr. Time provides better code readibility than random numbers representing amounts of time scattered through your code.
Ever needed to provide a timeout to a function call and had to google 'How many milliseconds in 24 hours'. Your options are:
setTimeout(myMethod, 86400000); // Nobody will have any idea how long this is
const TWENTY_FOUR_HOURS_IN_MILLISECONDS = 86400000; // I still had to google to get this number first...
setTimeout(myMethod, TWENTY_FOUR_HOURS_IN_MILLISECONDS);
let T = require('mr-time');
setTimeout(myMethod, T(24).hours.in.milliseconds); // No googling, easy to read, everyones happy
npm install mr-time
yarn add mr-time
let T = require('mr-time');
let oneDayInMilliseconds = T(1).days.in.milliseconds; // returns 86400000
let twoWeeksInSeconds = T(2).weeks.in.seconds; // returns 1210000
- Add month, year, decade, century, nanoseconds etc