From 04d421b1f406566e2df53296242b852401aba7e9 Mon Sep 17 00:00:00 2001 From: Gerardyang <1304274443@qq.com> Date: Fri, 4 Nov 2022 18:17:45 +0800 Subject: [PATCH] fix(route): fix luogu route date parse regex (#11200) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(route): fix luogu route date parse regex ``` text: "洛谷日报 第 417 期 2022 年 11 月 1 日" regex: \d{4} 年 \d{2} 月 \d{2} 日 ^ error here ``` * change DD to D and MM to M in date format. * fix regex to match month which is before Oct --- lib/v2/luogu/daily.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/v2/luogu/daily.js b/lib/v2/luogu/daily.js index cd7de0f93..39b558b4f 100644 --- a/lib/v2/luogu/daily.js +++ b/lib/v2/luogu/daily.js @@ -21,7 +21,7 @@ module.exports = async (ctx) => { link, author: firstPost.find('p').eq(1).text(), guid: `${link}#${issueHeading}`, - pubDate: parseDate(issueHeading.match(/(\d{4} 年 \d{2} 月 \d{2} 日)/)[1], 'YYYY 年 MM 月 DD 日'), + pubDate: parseDate(issueHeading.match(/(\d{4} 年 \d{1,2} 月 \d{1,2} 日)/)[1], 'YYYY 年 M 月 D 日'), }, ];