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) 263 B
"use strict";const e=36e5,t=24*e,s={year:315576e5,month:30*t,week:7*t,day:t,hour:e,minute:6e4,second:1e3,m:1};exports.seconds=e=>(e=>{if(+e)return+e;const[,t,n]=e.match(/^([^ ]+) +(\w\w*?)s?$/)||[];return+t*(s[n]||1)})(e)/1e3; //# sourceMappingURL=seconds.js.map