fix(route): fix luogu route date parse regex (#11200)

* 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
This commit is contained in:
Gerardyang 2022-11-04 18:17:45 +08:00 committed by GitHub
parent 63c2f82c01
commit 04d421b1f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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 年 MMDD 日'),
pubDate: parseDate(issueHeading.match(/(\d{4} 年 \d{1,2} 月 \d{1,2} 日)/)[1], 'YYYY 年 M 月 D 日'),
},
];