Skip to content

Commit

Permalink
fix:修复测试报告执行时间带数字9时,前面没有补零的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
JIang Bing committed Apr 10, 2024
1 parent d29b6ef commit 58d0209
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend/src/util/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ export const timestamp2time = function(timestamp) {
const M = (month < 10 ? "0" + month : month) + "-";

const days = date.getDate();
const D = (days + 1 < 10 ? "0" + days : days) + " ";
const D = (days < 10 ? "0" + days : days) + " ";

const hours = date.getHours();
const h = (hours + 1 < 10 ? "0" + hours : hours) + ":";
const h = (hours < 10 ? "0" + hours : hours) + ":";

const minutes = date.getMinutes();
const m = (minutes + 1 < 10 ? "0" + minutes : minutes) + ":";
const m = (minutes < 10 ? "0" + minutes : minutes) + ":";

const seconds = date.getSeconds();
const s = seconds + 1 < 10 ? "0" + seconds : seconds;
const s = seconds < 10 ? "0" + seconds : seconds;

return Y + M + D + h + m + s;
};

0 comments on commit 58d0209

Please sign in to comment.