const formatTime = date => { const year = date.getFullYear() const month = date.getMonth() + 1 const day = date.getDate() const hour = date.getHours() const minute = date.getMinutes() const second = date.getSeconds() return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') } const formatDate = date => { const year = date.getFullYear() const month = date.getMonth() + 1 const day = date.getDate() return [year, month, day].map(formatNumber).join('-') } const formatNumber = n => { n = n.toString() return n[1] ? n : '0' + n } const formatRichText = html => { let newContent= html.replace(/\ { console.log('dateTime', current.indexOf(defaultDate[index])) dateTime.push(current.indexOf(defaultDate[index])); }); return { dateTimeArray: dateTimeArray, dateTime: dateTime } } function getLocation() { return new Promise((reslove) => { wx.getLocation({ type: "gcj02", success(res) { let lat = res.latitude; let lng = res.longitude; const { latitude, longitude } = res; reslove({ msg: "success", data: { latitude, longitude, }, }); }, fail(err) { reslove({ data: "", msg: err.errMsg, }); }, }); }); } module.exports = { cardHide: cardHide, formatTime: formatTime, formatRichText: formatRichText, dateTimePicker: dateTimePicker, getMonthDay: getMonthDay, getNewDateArry, getLoopArray, getLocation, formatDate }