UNPKG

itty-time

Version:

Ultra-small (~390 bytes) library for TTL date math and converting ms durations to and from strings.

3 lines (2 loc) 258 B
const e=36e5,t=24*e,n={year:315576e5,month:30*t,week:7*t,day:t,hour:e,minute:6e4,second:1e3,m:1},r=e=>(e=>{if(+e)return+e;const[,t,r]=e.match(/^([^ ]+) +(\w\w*?)s?$/)||[];return+t*(n[r]||1)})(e)/1e3;export{r as seconds}; //# sourceMappingURL=seconds.mjs.map