1 |
- "use strict";function g(r){const e=r;let o,u,a,t;return e>=3600?(u=parseInt(`${e/3600}`,10)<10?`0${parseInt(`${e/3600}`,10)}`:parseInt(`${e/3600}`,10),a=parseInt(`${e%60/60}`,10)<10?`0${parseInt(`${e%60/60}`,10)}`:parseInt(`${e%60/60}`,10),t=e%3600<10?`0${e%3600}`:e%3600,t>60&&(a=parseInt(`${t/60}`,10)<10?`0${parseInt(`${t/60}`,10)}`:parseInt(`${t/60}`,10),t=t%60<10?`0${t%60}`:t%60),o=`${u}:${a}:${t}`):e>=60&&e<3600?(a=parseInt(`${e/60}`,10)<10?`0${parseInt(`${e/60}`,10)}`:parseInt(`${e/60}`,10),t=e%60<10?`0${e%60}`:e%60,o=`00:${a}:${t}`):e<60&&(t=e<10?`0${e}`:e,o=`00:00:${t}`),o}function h(r,e){const $=new Date().getTime()-r;let n="";if($<0)return;const i=$/6e4,c=$/36e5,l=$/864e5,f=$/6048e5;if(f>=1&&f<=4)n=` ${parseInt(`${f}`,10)}\u5468\u524D`;else if(l>=1&&l<=6)n=` ${parseInt(`${l}`,10)}\u5929\u524D`;else if(c>=1&&c<=23)n=` ${parseInt(`${c}`,10)}\u5C0F\u65F6\u524D`;else if(i>=1&&i<=59)n=` ${parseInt(`${i}`,10)}\u5206\u949F\u524D`;else if($>=0&&$<=6e4)n="\u521A\u521A";else if(e==1)n="";else{const s=new Date;s.setTime(r);const m=s.getFullYear(),I=s.getMonth()+1<10?`0${s.getMonth()+1}`:s.getMonth()+1,p=s.getDate()<10?`0${s.getDate()}`:s.getDate();n=`${m}-${I}-${p}`}return n}exports.caculateTimeago=h;exports.formatTime=g;
|