⏱️Tiny Expiration Helper For Node
Expects a string and returns a (then > now) unix timestamp for a later date
Expects a string and returns the delta between now and a later date in milliseconds
const expaft = require("expaft")
const laterDate = expaft("16 hrs 200 mins 500 secs")
const deltaNowThen = expaft.delta("16 hrs 200 mins 500 secs 200 ms")
console.log(laterDate)
// => a valid timestamp for a later date
console.log(new Date(laterDate))
// => a valid future date
console.log(deltaNowThen)
// => the time (in milliseconds) between now and the future timestamp
- A Type that represents a unit of time (e.g. 'minute', 'hour', 'hours', 'seconds')
- An Amount integer
'amount type amount type amount type...'
or
'type amount type amount type amount ...'
All time units are case-insensitive
- milliseconds
- millisecond
- msecs
- msec
- ms
- seconds
- second
- secs
- sec
- s
- minutes
- minute
- mins
- min
- m
- hours
- hour
- hrs
- hr
- h
- days
- day
- d