Create your milliseconds declaratively!
npm install --save time-chaineror
yarn add time-chainerimport Time from 'time-chainer';
// Do something after 5 seconds
setTimeout(() => {
doSomething();
}, Time.seconds(5));
// 3 Days and 12 hours later from now
new Date(
new Date() + (
Time
.days(3)
.hours(12)
)
);
// 1 week + 15 days + 12 hours + 30 minutes + 30 seconds + 500 milliseconds
Time
.milliseconds(500)
.seconds(30)
.minutes(30)
.hours(12)
.days(15)
.weeks(1)
; // 1,945,830,500