From c4c6d81a390b37c2e544b70a2d919f7f7b86c870 Mon Sep 17 00:00:00 2001 From: LanFly <1260022720@qq.com> Date: Wed, 28 Mar 2018 17:42:46 +0800 Subject: [PATCH] =?UTF-8?q?bug-fix:=20=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89format=E5=8C=85=E5=90=AB=E6=95=B0=E5=AD=97=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=A0=BC=E5=BC=8F=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/laydate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/laydate.js b/src/laydate.js index 0a75401..662ea07 100644 --- a/src/laydate.js +++ b/src/laydate.js @@ -435,6 +435,7 @@ var that = this ,options = that.config ,dateType = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s' + ,safeType = '\\w' ,isStatic = options.position === 'static' ,format = { year: 'yyyy' @@ -474,7 +475,7 @@ if(/^y$/.test(item)) return '1,308'; return '1,2'; }() +'}' - : '\\' + item; + : new RegExp(safeType).test(item) ? '' + item : '\\' + item; that.EXP_IF = that.EXP_IF + EXP; that.EXP_SPLIT = that.EXP_SPLIT + '(' + EXP + ')'; });