Skip to content

Commit

Permalink
fix(calendar): the example logic judgment is incorrect (#3442)
Browse files Browse the repository at this point in the history
  • Loading branch information
betavs authored Jan 13, 2025
1 parent bf78ec4 commit af19dbc
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/calendar/_example/calendar.wxs
Original file line number Diff line number Diff line change
@@ -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,
};

0 comments on commit af19dbc

Please sign in to comment.