2 lines
1.3 KiB
JavaScript
Executable File
2 lines
1.3 KiB
JavaScript
Executable File
var t={formatTime:function(t){if("number"!=typeof t||t<0)return t;var e=parseInt(t/3600);return t%=3600,[e,parseInt(t/60),t%=60].map((function(t){return(t=t.toString())[1]?t:"0"+t})).join(":")},formatLocation:function(t,e){return"string"==typeof t&&"string"==typeof e&&(t=parseFloat(t),e=parseFloat(e)),t=t.toFixed(2),e=e.toFixed(2),{longitude:t.toString().split("."),latitude:e.toString().split(".")}},getDateAllF:function(t){var e=t||new Date,r=e.getFullYear(),a=e.getMonth()+1;a=a<10?"0"+a:a;var n=e.getDate();n=n<10?"0"+n:n;var i=e.getDay();switch(i){case 1:i="一";break;case 2:i="二";break;case 3:i="三";break;case 4:i="四";break;case 5:i="五";break;case 6:i="六";break;case 0:i="日"}return{y:r,m:a,d:n,w:i}},dateUtils:{UNITS:{"年":315576e5,"月":26298e5,"天":864e5,"小时":36e5,"分钟":6e4,"秒":1e3},humanize:function(t){var e="";for(var r in this.UNITS)if(t>=this.UNITS[r]){e=Math.floor(t/this.UNITS[r])+r+"前";break}return e||"刚刚"},format:function(t){var e=this.parse(t),r=Date.now()-e.getTime();if(r<this.UNITS["天"])return this.humanize(r);var a=function(t){return t<10?"0"+t:t};return e.getFullYear()+"/"+a(e.getMonth()+1)+"/"+a(e.getDate())+"-"+a(e.getHours())+":"+a(e.getMinutes())},parse:function(t){var e=t.split(/[^0-9]/);return new Date(e[0],e[1]-1,e[2],e[3],e[4],e[5])}}};export{t as H};
|