init
This commit is contained in:
19
miniprogram/utils/time.wxs
Normal file
19
miniprogram/utils/time.wxs
Normal file
@ -0,0 +1,19 @@
|
||||
var splitTime = function (time) {
|
||||
return time.split(" ")[0];
|
||||
};
|
||||
|
||||
var formatDate = function (datestr) {
|
||||
if(!datestr) return null
|
||||
var date = getDate(datestr);
|
||||
var year = date.getFullYear();
|
||||
var month = date.getMonth() + 1;
|
||||
if (month < 10) month = "0" + month;
|
||||
var day = date.getDate();
|
||||
if (day < 0) day = "0" + day;
|
||||
return year + "-" + month + "-" + day;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
splitTime: splitTime,
|
||||
formatDate: formatDate,
|
||||
};
|
||||
Reference in New Issue
Block a user