From af19dbcb195549f80e254a353f8a9276d81e9902 Mon Sep 17 00:00:00 2001 From: betavs <34408516+betavs@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:14:59 +0800 Subject: [PATCH] fix(calendar): the example logic judgment is incorrect (#3442) --- src/calendar/_example/calendar.wxs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/calendar/_example/calendar.wxs b/src/calendar/_example/calendar.wxs index d062eba8b..c63e7142c 100644 --- a/src/calendar/_example/calendar.wxs +++ b/src/calendar/_example/calendar.wxs @@ -1,23 +1,25 @@ function getDateByTimestamp(val) { var date = getDate(val); - return [date.getFullYear(), date.getMonth() < 10 ? '0' + ( date.getMonth() + 1) : date.getMonth() + 1, date.getDate() < 10 ? '0' + date.getDate() : date.getDate()].join('-'); + var month = date.getMonth() + 1; + var day = date.getDate(); + return [date.getFullYear(), month < 10 ? '0' + month : month, day < 10 ? '0' + day : day].join('-'); } function formatTimestamp(val) { if (!val) return ''; var i = 0; - if(val.constructor && val.constructor == 'Array'){ + if (val.constructor && val.constructor == 'Array') { var _str = ''; for (var len = val.length; i < len; i++) { _str += getDateByTimestamp(val[i]) + '、'; - }; - return _str + } + return _str; } return getDateByTimestamp(val); -}; +} module.exports = { - formatTimestamp: formatTimestamp -} + formatTimestamp: formatTimestamp, +};