UNPKG

@sofaws/dapp-core

Version:

A library to hold the main logic for a dapp on the Elrond Network

3 lines (2 loc) 973 B
import{m}from"./chunk-HBP5N4FR.js";m();function h(n){let t=Math.floor(n/864e5),s=n%(24*60*60*1e3),e=Math.floor(s/(60*60*1e3)),o=s%(60*60*1e3),r=Math.floor(o/(60*1e3)),T=o%(60*1e3),i=Math.floor(T/1e3),c=i+" sec",f=r+" min",u=e+" hr",g=t+" day";if(i>1&&(c=i+" sec"),r>1&&(f=r+" min"),e>1&&(u=e+" hrs"),t>1&&(g=t+" days"),t>=1)return g+" "+u;if(e>=1){let a=r===0?"":" "+f;return u+a}if(r>=1){let a=i===0?"":" "+c;return f+a}return c}function l(n){let t=n.split(" ");return t.length>1?`${t[0]} ${t[1]}`:n}var M=(n=new Date,t=0)=>Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds()+t,n.getUTCMilliseconds());function d(n){let t=new Date,s=M(t),e=M(t,n);return Math.max(e-s,0)}function S(n,t=!0){let s=d(n),e=h(s);return t?l(e):e}function C(n){let s=new Date().getTime()-n;return Math.max(s,0)}function w(n,t=!0){let s=C(n),e=h(s);return t?l(e):e}export{h as a,S as b,w as c}; //# sourceMappingURL=chunk-XBLU7KZJ.js.map