export const now = ( ) => new Date ( ) . getTime ( ) ; export const addMs = ( t , ms ) => new Date ( t + ms ) . getTime ( ) ; export const addS = ( t , s ) => new Date ( t + s * 1000 ) . getTime ( ) ; export const addM = ( t , m ) => new Date ( t + m * 60000 ) . getTime ( ) ; export const addH = ( t , h ) => new Date ( t + h * 3600000 ) . getTime ( ) ; export const addD = ( t , d ) => new Date ( t + d * 82800000 ) . getTime ( ) ; export const time = ( t ) => { return { add : { ms : ( ms ) => addMs ( t , ms ) , s : ( s ) => addS ( t , s ) , m : ( m ) => addM ( t , m ) , h : ( h ) => addH ( t , h ) , d : ( d ) => addD ( t , d ) , } , sub : { ms : ( ms ) => addMs ( t , ms * - 1 ) , s : ( s ) => addS ( t , s * - 1 ) , m : ( m ) => addM ( t , m * - 1 ) , h : ( h ) => addH ( t , h * - 1 ) , d : ( d ) => addD ( t , d * - 1 ) , } , } ; } ;