Browse Source

限定构建时间模式(YYYY-MM-DD hh:mm),排除只提供“xx月xx日”的无效格式。

master
Julin 1 year ago
parent
commit
e356bb50ad
  1. 2
      web/routes/missionboard/index.js

2
web/routes/missionboard/index.js

@ -43,7 +43,7 @@ module.exports = {
} }
function extractBuildTime(inputString) { function extractBuildTime(inputString) {
const pattern = /[(\(]构建时间:(.*?)[\))]/; const pattern = /[(\(]构建时间[::](\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2})[\))]/;
const match = inputString.match(pattern); const match = inputString.match(pattern);
const buildDate = match ? moment(new Date(match[1])).format('YYYY-MM-DD HH:mm') : null; const buildDate = match ? moment(new Date(match[1])).format('YYYY-MM-DD HH:mm') : null;
return buildDate; return buildDate;

Loading…
Cancel
Save