21 lines
479 B
JavaScript
21 lines
479 B
JavaScript
// tool.js
|
|
// some tool function
|
|
let app = getApp()
|
|
function rpx2px(rpxNum) {
|
|
return rpxNum * app.globalData.rpx2px;
|
|
}
|
|
|
|
function t(t) {
|
|
return (t = t.toString())[1] ? t : "0" + t;
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
rpx2px: rpx2px,
|
|
formatTime: function(e) {
|
|
var n = e.getFullYear(), o = e.getMonth() + 1, r = e.getDate(), u = e.getHours(), i = e.getMinutes(), g = e.getSeconds();
|
|
return [ n, o, r ].map(t).join("/") + " " + [ u, i, g ].map(t).join(":");
|
|
}
|
|
}; |