From 9d44f89426d2e9c4eaa97e5655161167d9d6d2d1 Mon Sep 17 00:00:00 2001 From: xiongym <2976593822@qq.com> Date: Tue, 1 Jun 2021 00:00:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E4=B8=8E=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...gnTimeResolveAssemblyReferencesInput.cache | Bin 6915 -> 6959 bytes .../SYS.Library.csproj.FileListAbsolute.txt | 7 +++++++ 2 files changed, 7 insertions(+) diff --git a/SYS.Library/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/SYS.Library/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 0c8a8203e715c6a07d8a8334db3abaed1926c9e7..213c32f40b32f408dee7558ee6f0feebc9550172 100644 GIT binary patch delta 127 zcmZoRTW_{u3AakJt5r-uQGQlxa!E``enD||rAK~AYL0JWUSfJ`QE+8(NowxoP28Ut tizhGT(Fc-Oc@%);Hy(8$DaUILB*S>s7>hU8@&<9KSP@~`=DXr*%mCN8F2Vo+ delta 83 zcmZ2))@-(62{)gwt5uA9W=U#lOi5~S$>bBHsH3yP8 XylRZWn Date: Wed, 2 Jun 2021 10:04:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9EJVNUI=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=EF=BC=8C=E4=B8=8A=E4=BC=A02=E4=B8=AA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JVNUI/js/parseUtil.js | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 JVNUI/js/parseUtil.js diff --git a/JVNUI/js/parseUtil.js b/JVNUI/js/parseUtil.js new file mode 100644 index 0000000..a3bb590 --- /dev/null +++ b/JVNUI/js/parseUtil.js @@ -0,0 +1,53 @@ +//时间格式化 +export function parseTime(time, pattern) { + if (arguments.length === 0 || !time) { + return null + } + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time.replace(new RegExp(/-/gm), '/'); + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} +//保留小数点后两位(有浏览器差异) +export function compToFixed(number, precision) { + var str = number + '' + var len = str.length + var last = str.substr(len-1, len) + if (last == '5') { + last = '6' + str = str.substr(0, len-1) + last + return (str - 0).toFixed(precision) + } else { + return number.toFixed(precision) + } +} \ No newline at end of file -- Gitee