fix(route): 日本经济新闻中文版 (#10556)

* fix(route): 日本经济新闻中文版

* fix typo
This commit is contained in:
Ethan Shen
2022-08-21 05:14:38 +08:00
committed by GitHub
parent 26cb04c139
commit 57d5370109
+4 -1
View File
@@ -14,7 +14,10 @@ const cleanContent = (language, content) => {
}
};
const getPubDate = (link) => timezone(parseDate(link.match(/(\d{4}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2})/)[1], 'YYYY-MM-DD-HH-mm-ss'), +9);
const getPubDate = (link) => {
const matches = link.match(/(\d{4}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2}|\d{8})/);
return matches ? timezone(parseDate(matches[1], 'YYYY-MM-DD-HH-mm-ss'), +9) : undefined;
};
module.exports = async (ctx) => {
const language = ctx.params.language ?? 'cn';