//str 传入的日期格式为xx年xx月xx日
chDate2date (str) { return str.replace(/[年|月]/g, '-').replace('日', '') },
//start为开始日期 end为结束日期 getProcess (start, end) { start = +new Date(this.chDate2date(start)) end = +new Date(this.chDate2date(end)) let now = +new Date let rs = (now - start) / (end - start) rs = rs > 1 ? 1 : rs.toFixed(2) return rs * 100 }, formatTooltip (val) { let myDate = new Date() let currdentData = myDate.toLocaleDateString() return currdentData; }
本文介绍了一种将中文日期格式转换为标准日期格式的方法,并基于此实现了一个计算当前日期相对于两个指定日期之间的进度百分比的函数。此外,还提供了一个用于格式化提示信息中显示的当前日期的函数。
2871

被折叠的 条评论
为什么被折叠?



