fix: special date handling (#5135)

For example: 14-15 March 2020
This commit is contained in:
Henry Wang
2020-07-07 17:36:41 +08:00
committed by GitHub
parent bad165e67e
commit 8f8bc47ea0
+6 -2
View File
@@ -17,7 +17,11 @@ module.exports = async (ctx) => {
for (let i = 0; i < list.length - 1; i++) {
const content = cheerio.load(list[i]);
const date = content('td:nth-child(1)');
let date = content('td:nth-child(1)').text();
if (date.includes('-')) {
date = date.split('-')[1];
}
const resolution = content('td:nth-child(2)');
const meeting = content('td:nth-child(3)');
const agenda = content('td:nth-child(4)');
@@ -29,7 +33,7 @@ module.exports = async (ctx) => {
desc: `${country('body').html()} vetoed ${agenda.html()}. <br/> <br/> <b>Resolution: </b> ${resolution.html()}<br/><br/> <b>Meeting Record: </b> ${meeting.html()}`,
url: resolution.find('a').attr('href'),
guid: `scveto:${resolution.text()}`,
pubDate: new Date(date.text()).toISOString(),
pubDate: new Date(date).toISOString(),
};
items.push(item);